Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
曾经,我在一次讲座中听说使用?>关闭 PHP 文件会导致性能下降,这是真的吗?
?>
有趣的是,许多 php 应用程序和框架确实不使用?>. 可能是由于样板或性能?
代码中的空格,会影响应用程序的性能吗?
绝对不。打开/关闭 PHP 标记或代码中的空格没有可测量的性能差异。
不关闭 PHP 标记的一个常见原因是文件末尾的杂散空行不会最终输出到客户端。如果您有一个纯 PHP 文件,则没有理由关闭 PHP 标记。