PHP header function jump

Source: Internet
Author: User

<? PHP
If (1 ){
Header ("Location: http://www.baidu.com /");
}
Header ("Location: 01.php ");
Header ("Location: 03.php ");
Header ("Location: http://www.sina.com ");
Echo & quot; 111 & quot ";
Header ("Location: http://www.g.cn ");
Echo & quot; 222 & quot ";
Header ("Location: http://www.163.cn ");
Echo & quot; 333 & quot ";
?>

Why does the above Code not jump to the header ("Location: http://www.baidu.com /");?

Another problem is that the server reads the PHP file and sends it to the client a little bit, or does it send it to the client after reading it once? How does JavaScript read it?

 

 

PHP scripts are read sequentially from top to bottom, after one-time reading on the server end to the client, this file, when read if should be sent header ("Location: http://www.baidu.com /"); however, there are headers ("Location: 01.php") below ");
Header ("Location: 03.php ");
Header ("Location: http://www.sina.com"); will continue to read the last line, Echo priority is lower than the header, when many headers are tied together will display the last line, just like displaying an array, $ Forum [] Only displays the last record in the array when you write echo $ forum. Javascript is a client script. After downloading your page, all the Javascript script files are already in your computer and will only respond to the operations.

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.