如下所示: $http_type = ((isset($_SERVER['HTTPS']) $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) 'https://' : 'http://';echo $http_type . $_SERVER['HTTP_HOST']
如下所示:
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; echo $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; ?>
以上这篇对php 判断http还是https,以及获得当前url的方法详解就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持易盾网络。