Through the PHP function to detect whether the server supports SSL (that is, HTTPS connection), the specific function code is as follows. Also about how to turn on SSL support can refer to this site article:
PHP detects whether the server SSL is turned on and how to turn on SSL
*
* Detect whether the server supports SSL connection (HTTPS connection)
* @return bool/
function Is_ssl () {
if (!isset ($_server[' https ')) ) return
FALSE;
if ($_server[' HTTPS ']===1) { //apache return
TRUE;
} ElseIf ($_server[' HTTPS ']=== ' on ') {//iis return
TRUE;
} ElseIf ($_server[' Server_port ']==443) {//other return
TRUE;
}
return FALSE;
}
For example:
echo Is_ssl ()? ' Support ': ' Not supported ';
Articles that you may be interested in
- PHP detects whether the server SSL is turned on and how to turn on SSL
- PHP to determine whether the string is full English, pure Chinese, in combination with the English method
- A summary of how PHP determines whether the date format is correct
- How to know if the server supports gzip compression
- How PHP determines whether the current operating system is Linux or Windows
- PHP to determine whether a remote file exists
- PHP implementation of the same server with multiple two-level domain share session data
- PHP Analysis file header information to determine the type of upload file