Can I redirect two pages in a single COMMAND?
I want to redirect two pages at once.
if(any statement) {
Header("开发者_如何转开发Location: http://example.com/page.php");
Header("Location: folder/page.php"); }
else { echo " comment "; }
Will this work?
Found a solution see on comments.No. Why on Earth would you want to? Even if you could, how do you think a browser can display the two pages? New windows/tabs? But what if it's a windowless browser (like lynx)?
If you use the above code, PHP will replace the first location header with the second as no headers are actually sent until you start outputting content, after which you cannot call header().
精彩评论