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 some articles, a summary of the PHP closing tag is as follows:
Benefits:If this is a program that someone else contains, without this terminator, you can reduce a lot of problems, such as: header, Setcookie, session_start These actions can not have output before, if accidentally added to the?> behind the invisible character (extra space, NewLine characters, such as Broken page display, will be reported "Header already sent" error, do not write the words will not have this problem. Alternatively, you can move the cursor directly to the end and then program.
Disadvantages:In Dreamweaver's view mode, it's a mess.
The official explanation for the PHP closing tag is that the PHP closed tag "?>" in PHP is optional for PHP parser. However, if you use a closed tag, any space behind the closed tag by a developer, user, or FTP application may cause extra output, PHP errors, output that cannot be displayed, and blank pages. Therefore, all PHP files should omit this PHP closed tag, and insert a note to indicate that this is the file's bottom and locate the file in the relative path of the application. This will help you to make sure that the document is over and not truncated.
This is also mentioned in the Code specification for Zend: http://framework.zend.com/manual/1.12/en/coding-standard.php-file-formatting.html
code Example:
Improper:
Copy CodeThe code is as follows:
echo "Here ' s my code!";
?>
Suitable for:
Copy CodeThe code is as follows: echo "Here ' s my code!";
/* End of File myfile.php */
/* location:./system/modules/mymodule/myfile.php */
Therefore, if it is a pure PHP code file, you should omit the?> end identifier.
http://www.bkjia.com/PHPjc/736809.html www.bkjia.com true http://www.bkjia.com/PHPjc/736809.html techarticle 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 ...