【发布时间】:2012-01-05 04:40:44
【问题描述】:
我正在编写一个脚本,其中最后有一个重定向标头。
然后,如果出现特定条件,我会在中间添加一个重定向标头。
我很惊讶地注意到最后一个标头(“Location:http//mydomain.com”)是触发的标头。我以为标题会自动从页面“跳转”,但它似乎只是将它保存在内存中并首先遍历整个页面。
关于“切割”流程和更改页面的“正确”方法是什么?
<?php
$specific_condition=true;
// I wanted this to be the end
if($specific_condition) header("Location: http://google.com/");
// But it still triggers following redirect
header("Location: http://bing.com/");
?>
【问题讨论】:
标签: php redirect header location