Whether there should be exit_PHP tutorials after phpheader

Source: Internet
Author: User
Tags exit in
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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.