更新时间:2023-12-01 19:05:04
我之前的做法和你写的基本一样,只是没有任何硬编码值:
The way I've done it before is basically like what you wrote, but doesn't have any hardcoded values:
if($_SERVER["HTTPS"] != "on")
{
header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
exit();
}