php开发时有关的问题(errors header already sent)。 脚本结束加“?>”好还是不加好。drupal->coding standards的建议。 Removing it eliminates the possibility for unwanted whitespace at the end of files which can cause "header already sent" errors, XHTML/XML validation issues, and other problems. The closing delimiter at the end of a file is optional. PHP.net itself removes the closing delimiter from the end of its files (example: prepend.inc), so this can be seen as a "best practice."
php开发时有关的问题(errors header already sent)。 脚本结束加“?>”好还是不加好。drupal->coding standards的建议。
Removing it eliminates the possibility for unwanted whitespace at the end of files which can cause "header already sent" errors, XHTML/XML validation issues, and other problems.
The closing delimiter at the end of a file is optional.
PHP.net itself removes the closing delimiter from the end of its files (example: prepend.inc), so this can be seen as a "best practice."
如果有?>,而且后面还不小心跟了一个空格之类的,那当别的文件require了它,然后又要更改header时,就会出现错误了(用缓冲的除外)。
所以个人认为没有?>是个好习惯。