![](/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.