In ASP, Server. Transfer can be used to implement Server-side redirection. Although PHP does not have such a function, it is not difficult to implement similar redirection.
In ASP, Server. Transfer can be used to implement Server-side redirection. Although PHP does not have such a function, it is not difficult to implement similar redirection.
(Note that it is not a client jump using header, js, or 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.