溫馨提示×

怎么辨別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