PHP头函数修改查询字符串(如果是url)
看到php头函数修改查询字符串(如果它是URL)非常奇怪。我使用了这样的头函数PHP头函数修改查询字符串(如果是url),php,redirect,Php,Redirect,看到php头函数修改查询字符串(如果它是URL)非常奇怪。我使用了这样的头函数 header('位置:http://www.example.com/account-type?goto=http://www.google.com/hello'); 这是重定向到http://www.example.com/account-type?goto=http/hello修改的查询字符串 如果我使用相对URL 标题('位置:/account type?转到=http://www.google.com/hell
header('位置:http://www.example.com/account-type?goto=http://www.google.com/hello');代码>
这是重定向到http://www.example.com/account-type?goto=http/hello
修改的查询字符串
如果我使用相对URL
标题('位置:/account type?转到=http://www.google.com/hello');代码>
这将重定向到http://www.example.com/account-type?goto=http://www.google.com/hello
有人能告诉我如何解决这个问题吗?我想这只是一个编码问题。试试这个:
$url = urlencode('http://www.google.com/hello');
header('Location: http://www.example.com/account-type?goto=' . $url);
您可能需要调用goto参数。我希望您正在验证重定向。如果不查看位置
标题,则需要一个绝对URI(即使大多数浏览器会悄悄地从错误中恢复)。我只面临一台服务器的问题。其他人完全可以。相同的PHP,Apache版本。嗯,我不知道其他服务器的情况,但这台服务器上肯定需要url编码。