Whether exit exists after phpheader. After phpheader, do you need to write exit to terminate the program? I didn't care too much about it before. today I encountered a bug and found this problem. I wrote a code segment to test it, code such as php header whether to write exit to terminate the program has never been too concerned, today encountered a bug, only to find this is a problem, specially write a code segment to test, the code is as follows:
It turns out that if the php file encounters a header ("Location: a page URL") during running, it will jump directly to another page, however, the redirection does not affect the execution of the current php file. That is to say, after the php header jump, the script on the current page will continue to be executed. To terminate the script, add exit () or die ().
Articles you may be interested in
- Php get_headers determines whether the URL is valid
- Functions and usage of the php get_headers function
- Php uses header () to download files. the downloaded files prompt that they are damaged and cannot be opened.
- Simulate the get_headers function in php.
- Php header 404 jump to the error page
- Php header usage summary
- Use break, continue, goto, return, and exit in multiple loops in PHP
- Php searches for the existence of a value in the array (in_array (), array_search (), array_key_exists ())
After the http://www.bkjia.com/PHPjc/764074.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/764074.htmlTechArticlephp header whether to write exit to terminate the program, previously did not care too much, today encountered a bug, only to find this is a problem, specially written a code test, code such...