zoukankan      html  css  js  c++  java
  • 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里面开启。就可以识别了

  • 相关阅读:
    mysql主从之双主配置
    mysql主从之binlog的工作模式
    mysql主从之主机名导致主从机制失败的问题
    python_文件 处理
    python_字典 学习
    python_元组 学习
    python 基础内置函数表及简单介绍
    python 列表学习
    python函数基础学习
    python迭代器、生成器、列表推倒式
  • 原文地址:https://www.cnblogs.com/maxmys/p/3327195.html
Copyright © 2011-2022 走看看