Why would one omit the close tag?

前端 未结 14 1557
旧巷少年郎
旧巷少年郎 2020-11-21 06:18

I keep reading it is poor practice to use the PHP close tag ?> at the end of the file. The header problem seems irrelevant in the following context (and this

14条回答
  •  无人共我
    2020-11-21 07:01

    Well, I know the reason, but I can't show it:

    For files that contain only PHP code, the closing tag (?>) is never permitted. It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response.

    Source: http://framework.zend.com/manual/en/coding-standard.php-file-formatting.html

提交回复
热议问题