thinkphp5 http重定向https
php 将http重定向https thinkphp5添加首页入口文件第一行
// [ 入口文件 ] //将http重定向到https if(!(!empty($_SERVER[‘HTTPS’]) && $_SERVER[‘HTTPS’] !== ‘off’ || $_SERVER[‘SERVER_PORT’] == 443)) { $url = ‘https://’.”$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]”; header(‘Location:’.$url); exit; }