![](/img/trans.png)
[英]How to redirect in php with “headers already sent” common error (gCaptcha + redirection)
[英]php redirection headers not sent through ajax call
我试图从使用ajax调用的php文件发送标头。 问题是,当我用PHP验证所有信息时,我想重定向到另一个页面,但标题不起作用! 有任何想法吗?
代码的作用:
//------------- index.php
on click of input, function passes <input> values through $_POST to login.php
if($_SESSION[superman]==true){redirects to index_main.php}
//------------- login.php
all it does is validate forms and if login and password are correct, it sets $_SESSION [superman]=true
重定向只会重定向Ajax调用 ! 如果要在浏览器中更改显示的页面,则需要在Ajax调用完成后使用Javascript重定向。
true
或者您要加载的页面的URL) location.href
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.