温馨提示×

怎么辨别http和https

九三
237
2021-03-01 17:20:38
栏目: 编程语言

怎么辨别http和https

利用php对http与https进行辨别,具体方法如下:

$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';


0