header('location:index.php');
redirectPage('index.php');
//即使转向后不使用exit()程序会继续执行下面的代码。测试时,注意本文件夹可写权限
$f = fopen('a.php','w');
fwrite($f,'hahahha');
fclose($f);
/**
* url redirect
*
* @param string $url
*/
function redirectPage($url){
echo sprintf(" location.assign('%s'); ",$url);
}
?>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13523843/viewspace-441024/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13523843/viewspace-441024/
本文介绍PHP中实现页面重定向的方法,并演示了即使在使用header进行重定向后,仍能继续执行后续代码的过程。通过一个简单的示例,展示了如何在重定向后依然向本地文件写入内容。
3398

被折叠的 条评论
为什么被折叠?



