我有一个first.php
页
header("Location: script/script1.php")
和script1.php
有另一个
header("Location: first.php")
但它给我发显然是/script/first.php
。有没有一种方法来重定向它<root>/first.php
代替<root>/script/first.php
?
有这样的尝试:
header("Location: ../first.php")
或使用绝对路径或URL代替。
说明:..
是用于“父目录”的Unix / Linux中表达。互联网是UNIX的土地,这样的规则适用也有。
相反的:header("Location: ../first.php")
试试这个:header("url: ../first.php")
这将改变url.Using位置并不在某些情况下工作
因为:'../'
是表示“父母directory'.So,这将工作。
你可以这样做。在“0”秒重定向到主目录(根) -
<?php
header('Refresh: 0, url = /Root_Dir/');
?>
您的目录名替换“ROOT_DIR”。