更新时间:2023-02-26 13:35:38
$ _ SERVER ['HTTPS']
如果脚本设置为非空值通过HTTPS协议查询。
注意:当使用ISAPI和IIS时,如果请求不是通过HTTPS协议进行的,则值 off 。
Set to a non-empty value if the script was queried through the HTTPS protocol.
Note: Note that when using ISAPI with IIS, the value will be off if the request was not made through the HTTPS protocol.
http:// www .php.net / manual / en / reserved.variables.server.php
Ergo,这样做:
Ergo, this'll do:
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
// SSL connection
}