PHP server page jump implementation method _ PHP Tutorial-php Tutorial

Source: Internet
Author: User
Tags php server
PHP server page jump implementation method. (Note that the client jump is not implemented using headers, js, and other methods.) The Copy code is as follows: functionserver_transfer ($ dest) {global ...; the variables on the current page that you want to use on the new page or (note that the client jump is not implemented using headers, js, and other methods)

The code is as follows:


Function server_transfer ($ dest)
{
Global...; // list the variables on the current page or custom global variables you want to use on the new page.
Include $ dest; // run the new script
Exit; // exit the script
}



Note:
1. if any data output before the jump is displayed on the new page, it can be cleared before the jump unless the ob_start buffer is used. this will not affect each other.
2. because the new page runs in a custom function scope, the variables defined on this page will not affect the new page. this is both a benefit and a disadvantage.
3. on the new page, you can still use Super global variables such as $ _ POST to access the variables originally on this page. note the need to write code.
4. to repeat the content of this page and the new page, if both pages contain the same page, such as the header and footer, use require_once.

All in all, the jump can be done, but the programmer must know what happened, otherwise it is easy to get some strange results.

Http://www.bkjia.com/PHPjc/325778.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/325778.htmlTechArticle (do not use header, js and other methods to do the client jump) code is as follows: function server_transfer ($ dest) {global ...; // Set the variables on the current page or...

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.