This article introduces how to use PHP to bring up a prompt box and jump to a new page, that is, what you think is redirection. The following example can be used as a reference.
This article introduces how to use PHP to bring up a prompt box and jump to a new page, that is, what you think is redirection. The following example can be used as a reference.
To write a demo in the past two days, you need to use the prompt and jump. The main page does not have high requirements and you don't think it is necessary to use AJAX, JS, etc. So I studied how to prompt and jump in PHP.
At first, we used the following:
The Code is as follows:
Echo "script" alert ('sucess '); parent. location. href ='/user/Index'; script ";
Alert contains the prompt message and href is the page to jump to after the prompt.
Later I remembered that there was a redirect () redirection method in the TP framework, so I went and looked at it.
However, TP does not bring a pop-up window, so I changed it myself:
The Code is as follows:
Echo "script" alert ('no loginid'); script ";
Echo" ";
$ Url is the page to jump to. At the same time, this can also control the jump time. The value 0 after content indicates that the page will jump after 0 seconds.
Here, Mo Li provides two direct jump methods:
The Code is as follows:
Header ("Location:". PSYS_BASE_URL. "user/index ");
And
The Code is as follows:
Header ("refresh: {$ time}; url = {$ url }");
There are no prompts for these two methods, so you can jump directly. The following is recommended.
Finally, there is another problem: after the jump code is followed by a return, because the following statement will be executed