PHP checks whether server SSL is enabled, that is, whether HTTPS connections are supported.

Source: Internet
Author: User

PHP checks whether server SSL is enabled, that is, whether HTTPS connections are supported.

Use the php function to check whether the server supports SSL (HTTPS connection). The specific function code is as follows. For more information about how to enable SSL support, refer to this article:

Php checks whether server SSL is enabled and how to enable SSL

/** Check whether 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 ()? 'Supported ': 'unsupported ';
Articles you may be interested in
  • Php determines whether the string is full of English, pure Chinese, and a combination of Chinese and English
  • Php checks whether server SSL is enabled and how to enable SSL
  • Summary of methods for php to determine whether the date format is correct
  • How do I know whether the server supports Gzip compression?
  • PHP allows multiple second-level domain names on the same server to share SESSION data
  • How does php determine whether the current operating system is linux or windows?
  • Php methods to determine whether a remote file exists
  • Php performance optimization: Using isset () to determine the string length is faster than strlen ()

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.