gpt4 book ai didi

PHP 如何将标题定位到父目录中的页面?

转载 作者:可可西里 更新时间:2023-11-01 12:27:09 26 4
gpt4 key购买 nike

我有一个 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 领域,所以规则也适用于那里。

关于PHP 如何将标题定位到父目录中的页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13366217/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com