A probe into the reasons why PHP files do not write closed tag conventions

Source: Internet
Author: User
When I first started to write PHP code, I was going to write PHP closed tags, and then used to change, no longer write PHP closed tags. This concept was first approached from Drupal and was a bit unaccustomed at first-why not write a closed tag? It's not perfect, it's not suitable for people with obsessive-compulsive disorder. Later, in the work of the problem caused by the closure of the label, it began not to write closed tags.

For a pure php file, the reason for not writing closed tags is to prevent the closure of the label after the extra space, tabs, etc., in the rendering of the page will output these extra characters, resulting in page dislocation; it is also possible that you have a PHP file containing another PHP file, and use the header function, In another PHP file, because there are extra characters behind the enclosing tag, the final page will get an error due to the output before the header function. Therefore, it is highly recommended that you do not write closed tags in pure php files.

This is also mentioned in the Code specification for Zend: http://framework.zend.com/manual/1.12/en/coding-standard.php-file-formatting.html

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.