获取请求服务器传输协议http or https

$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";

echo $protocol.$_SERVER['HTTP_HOST']

 

posted on 2017-10-30 19:59  爱吃柠檬不加糖  阅读(131)  评论(0编辑  收藏  举报

导航