PHP如何判断网页协议是http还是https
super
2022-04-12 14:51

使用$_SERVER获取
$_SERVER['REQUEST_SCHEME']

版本:PHP7.1+
服务器:Nginx1.18.0
项目框架:ThinkPHP5.1+
站点伪静态:
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
0 条讨论