Home > Article > Backend Development > What does php end with?
We know that php files have the starting symbol . The starting symbol is necessary, but the ending symbol cannot be used indiscriminately.
When PHP is embedded in an HTML page, the terminator is necessary to distinguish code blocks. It is not recommended to add it at other times. If this is a program included by others, without this end character, many, many problems can be reduced.
For example: header
,setcookie
, session_start
There must be no output before these actions. If you accidentally add ?> after Visible characters (extra spaces, newlines), etc. that damage the page display will cause a "Header already sent
" error. If you don't write it, you won't have this problem.
Example:
##The above content is for reference only! Recommended tutorial:The above is the detailed content of What does php end with?. For more information, please follow other related articles on the PHP Chinese website!