以下是我的服务器结构:
folder_in_root
another_folder/not_root_here
another_folder/nested_script.php
index.php #in root
one_script_in_root.php #in root我有以下函数在中运行--所有服务器的脚本,不管是根用户还是非根用户:
function notify(){
(...)
if ( !(strpos($_SERVER['SCRIPT_NAME'], 'index.php')) && ($feedback["connect_time"] == 0 || $feedback["http_code"] == 404)){
exit("<meta http-equiv='refresh' content='0' ;url='../index.php'>");
}
}如果该函数位于index.php中,则不会刷新页面,这是很好的;如果没有在index.php 中,则该函数将不会刷新页面,而当原始脚本在根上是而不是时,该函数将不会刷新页面。因此,这个脚本在another_folder/not_root_here、another_folder/not_root_here、index.php中工作,但是在one_script_in_root.php中失败了,因为它不断地刷新one_script_in_root.php,而不是将用户发送到index.php。我搞不懂为什么会这样。有人能帮帮我吗?泰文。
发布于 2015-08-26 14:54:10
这种元刷新语法错误。
<meta http-equiv="refresh" content="0; URL=../index.php">将是正确的
发布于 2015-08-26 14:48:20
index.php位于域的根目录,所以只需重定向到/
url="/“
顺便说一句,你可以用位置标头代替。
发布于 2015-08-26 14:59:53
最好的解决方案是将index.php替换为您的域名/ip。这使得该函数可以在您所称的任何目录上工作。
<meta http-equiv="refresh" content="0; URL=\\www.mydomain.com">https://stackoverflow.com/questions/32229561
复制相似问题