php文件省略尾端闭合符

php文件省略尾端的 ?> 是可选的,但是可能的话,省略它是一个好方法,如果?>后续有空白,就会被当作内容输出,就可能会引起各种错误。。和bom的效果差不多,特别是header之类的。

Note: The closing tag of a PHP block at the end of a file is optional, and in some cases omitting it is helpful when using include() or require(), so unwanted whitespace will not occur at the end of files, and you will still be able to add headers to the response later. It is also handy if you use output buffering, and would not like to see added unwanted whitespace at the end of the parts generated by the included files.

转载请注明来源:Leoncom-《php文件省略尾端闭合符》
Trackback

no comment untill now

Add your comment now