开发者

Can I redirect two pages in a single COMMAND?

开发者 https://www.devze.com 2023-04-08 20:23 出处:网络
I want to redirect two pages at once. if(any statement) { Header(\"开发者_如何转开发Location: http://example.com/page.php\");

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().

0

精彩评论

暂无评论...
验证码 换一张
取 消