PHP标头位置重定向在iPhone上不起作用
I have a PHP script that is supposed to redirect to a dynamic fallback URL after having executed some code. I use it to redirect user to a specific URL i.e. after a successful log in. The code is:
header('Location: '. rawurldecode('/index.php?'));
This code works well on all 3 major browsers, however, the header-location simply does not work work on iPhone. I have tested on Safari and also Chrome for iOS : both won't work.
I have also tried hard-coded full-length URLs, without success.
header("Location: http://google.com/");
EDIT
I have tried to input the domain in the redirect statement. This seems to fix the problem on the mobile browsers, but now breaks on desktop browsers...
header('Location: http:' . $_SERVER[HTTP_HOST]. rawurldecode($_GET['redirect']));
我有一个PHP脚本,应该在执行一些代码后重定向到动态回退URL。 我使用它将用户重定向到特定的URL,即成功登录后。代码是: p>
header('Location:'。rawurldecode('/ index.php? '));
code> pre>
此代码适用于所有3种主流浏览器,但是,标头位置在iPhone上无法正常工作。 我已经在Safari和Chrome for iOS上进行了测试:两者都不起作用。 p>
我也尝试过硬编码的完整网址,但没有成功。 p>
\ n
header(“Location:http://google.com/");
nnEDIT p>
我试图在redirect语句中输入域名。 这似乎解决了移动浏览器上的问题,但现在在桌面浏览器上中断...... p>
header('Location:http:'。$ _SERVER [HTTP_HOST] .rawurldecode ($ _GET [ '重定向']));
code> pre>
div>
You can try the javascript way of redirecting the page:
Example :
echo '<script>window.location = "'.$url.'";</script>';
die;
It may help ...!!
try this if you reload current page.
echo '<script>location.reload();</script>';