如果在執行php程序時看到這條警告:"Warning: Cannot modify header information - headers already sent by ....".
有以下幾種解決方法:
1. Blank lines (空白行):
,檢查 后面沒有空白行,特別是include或者require的文件.不少問題是這些空白行導致的。
2. Use exit statement (用exit來解決):在header后加上exit();
header ("Location: xxx");exit();
3.用Javascrīpt來解決:
self.location( file.php );"; ?>
可以用Javascrīpt來代替header。另外需要注意,采用這種方法需要瀏覽器支持Javascrīpt.
4. 用輸出緩存來解決: