Home  >  Article  >  Backend Development  >  Another way to implement page jump in php

Another way to implement page jump in php

WBOY
WBOYOriginal
2016-07-25 09:05:52948browse
  1. function server_transfer($dest)
  2. {
  3. global ...; // List the variables of this page or customized global variables that you want to use in the new page here
  4. include $ dest; // Run new script
  5. exit; // Exit this script
  6. }
  7. ?>
Copy code

Note: 1) If any data output before the jump will be displayed in the new page, unless the ob_start buffer is used, it can be cleared before the jump, so that it will not affect each other. 2) Since the new page runs within a custom function scope, the variables defined on this page will not affect the new page. This has both advantages and disadvantages. 3) New pages can still use super-global variables such as $_POST to access variables that originally belong to this page. You need to pay attention when writing code. 4). Consider the issue of repeated inclusion of this page and the new page. If both pages contain the same page, such as headers and footers, require_once should be used.

>>>> Articles you may be interested in: Summary of various methods of PHP page jump Page jump code (php, asp, js multiple versions) PHP Header page jump precautions php url redirection (page jump) code Several ways to implement page jump in php Header jump and include inclusion problem example analysis



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn