我正在編寫一個腳本,最後我有一個重定向標題。標題位置一次不重定向,尋找替代品
然後我在中間添加了一個重定向頭,如果出現特定的情況。
我很驚訝地注意到最後一個標題(「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/");
?>
太棒了,解決了它。現在我只需要等10分鐘來接受你的回答。 :) – Paul 2012-01-05 04:46:12