php 判断网站是http还是https

//判断是http还是https
$http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://';
//全路径
$urls = $http_type . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']

 

posted @ 2019-10-12 16:42  钧一  阅读(3514)  评论(0编辑  收藏  举报