PHP

     最最开始的时候经常遇到这个问题,就是如果一个文件里面全部都是php代码的话,我写了前闭合和后闭合的时候,文件一多就容易报错,老是说什么有关输出的错误,貌似大概就是header已经发了。  

 手册上面这个样子说的

If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.

    大概的意思是,如果一个文件是纯的PHP代码,那么我应该不写后闭合标签。这个避免了我们无意识在最后加上的空格和新行。因为如果有PHP标签之外的东西,那么就认为是文本内容,就会入缓冲区的栈,这个时候如果你后来才输出了头部和BODY的话,那么肯定就悲剧了耶。大概就是这个意思。

    还有就是<??>这个短标签可在ini里面开启。就可以识别了

原文地址:https://www.cnblogs.com/maxmys/p/3327195.html