Do not write at the end of the PHP file? What are the benefits of & amp; gt;
- // This is B. php
- Include a. php
- Session_start ();
- ?>
-
I have seen that many php files do not contain the php Terminator. today I see a demo, which just Explains No.> The benefit of the Terminator. The following is a. php: Pay attention to the fourth line, the fifth line)
- Include File. php
- Session_start ();
- ?>
-
When you run the second file, you will find it throws a warning saying that header already send out The main reason is that a. php still has several blank lines after the PHP Terminator is called, so PHP will regard it as html code. does it have header output before session_start is called. No output is allowed before session_start is called, so the program will throw a warning. If you use?>, This error may be made inadvertently. when the project is large and the code is large, it is very difficult to find such a problem. Therefore, it is best not to write the php file?>, This is the practice officially recommended by zend. |