This concept was first introduced in Drupal and was a bit unaccustomed at the beginning-why not write a closed tag? This is not perfect. It is not suitable for people with obsessive-compulsive disorder! Later, I encountered a problem caused by TAG closure in my work, so I started not to write the closed tag.
I have read some articles and summarized the PHP closed labels as follows:
Benefits:If this is a program that is included by others and does not have this Terminator, it can reduce many problems, such as header, setcookie, and session_start, there cannot be output before these actions, if you are not careful When invisible characters (extra spaces and line breaks) are added to the backend to destroy the page display, the "Header already sent" error will be reported. If you do not write it, this problem will not occur. In addition, you can directly move the cursor to the end and then program.
Disadvantages:In the dreamweaver view mode, it is a mess.
The official explanation for PHP closed tags is: PHP closed tags "?> "PHP analyzer is optional in PHP. However, if you use closed tags, any developer, user, or the spaces after inserting the closed tag in the FTP application may cause redundant output, php errors, and subsequent output failures or blank pages. Therefore, all php files should omit this php closed tag and insert a comment to indicate that this is the bottom of the file and locate the relative path of the file in this application. This will help you determine that the file has been ended rather than deleted.
This is also mentioned in Zend's code specification: http://framework.zend.com/manual/1.12/en/coding-standard.php-file-formatting.html
Sample Code:
Improper:
Copy codeThe Code is as follows:
<? Php
Echo "Here's my code! ";
?>
Appropriate:
Copy codeThe Code is as follows: <? Php
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, should it be omitted?> End identifier.