PHP to determine whether the server SSL is enabled, that is, to determine whether to support HTTPS connection _php tutorial

Source: Internet
Author: User

PHP to determine whether the server SSL is enabled, that is, to determine whether to support HTTPS connection


Through the PHP function to detect whether the server supports SSL (that is, HTTPS connection), the specific function code is as follows. Also on how to turn on SSL support can refer to this site article:

PHP detects if server SSL is turned on and SSL is turned on

/** detects if the server supports SSL connections (HTTPS connections) * @return bool*/function Is_ssl () {if (!isset ($_server[' HTTPS))) return False;if ($_server[ ' HTTPS ']===1) {  //apachereturn TRUE;} ElseIf ($_server[' HTTPS ']=== ' on ') {//iisreturn TRUE;} ElseIf ($_server[' Server_port ']==443) {//other return TRUE;} return FALSE;}

For example:

echo Is_ssl ()? ' Support ': ' does not support ';

Articles you may be interested in

    • PHP to determine whether the string is in English, pure Chinese, the method of combination of English
    • PHP detects if server SSL is turned on and SSL is turned on
    • Summary of how PHP determines the correct date format
    • How to know if the server supports gzip compression
    • PHP to share SESSION data with multiple level two domain name servers
    • How PHP determines whether the current operating system is Linux or Windows
    • PHP to determine if a remote file exists
    • PHP Performance Optimizations: Use Isset () to determine string length faster than strlen ()

http://www.bkjia.com/PHPjc/982050.html www.bkjia.com true http://www.bkjia.com/PHPjc/982050.html techarticle PHP Determines whether the server SSL is enabled, that is, to determine whether to support HTTPS connection through the PHP function to detect whether the server supports SSL (that is, HTTPS connection), the specific function code is as follows. The other closed ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.