php执行了header("Location: index.php");后面程序会继续执行吗?

如果在php里,执行了header("Location: index.php"); 那后面剩下的代码php会将其执行完吗?要是会的话,如何让其在header这里终端呢?

第1个回答  2013-11-13
以下的代码是会往下执行的,你可以试试以下的代码。<?phpheader('Location: http://www.leakon.com/');$fp = fopen('header.txt', 'w+');fwrite($fp, date('Y-m-d H:i:s'));?>肯定会执行到fwrite函数的,打开header.txt文件,检查时间!可以用exit退出不执行以下代码。为了避免到处都是exit,可以写一个专门用作转向的函数,比如:<?phpfunction DoRedirect($strUrl) { header('Location: ' . $strUrl); exit;}?>
第2个回答  2013-11-13
在这里就跳到index.php页面了。不会执行下面的代码了。
相似回答