可以使用session来判断是否已经跳转过:

session_start(); if (!isset($_SESSION['redirected'])) { $_SESSION['redirected'] = true; $current_url = "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $new_url = "http://www.host.gay" . $_SERVER['REQUEST_URI']; header("Location: $new_url"); exit(); } else { // 已经跳转过,不再跳转 }

加个判断每次访问只跳转一次不二次获取$current_url = http $_SERVERHTTP_HOST $_SERVERREQUEST_URI;$new_url = httpwwwhostgay $_SERVERREQUEST_URI;headerLocation $new_url;exit;

原文地址: https://www.cveoy.top/t/topic/cG79 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录