A very simple demo that needs to implement prompts and jumps. The main page requirements are not high, and I feel there is no need to use AJAX, JS, etc.
So I studied the PHP prompt and jumped.
Start using the following jump:
echo "<script> alert('sucess');parent.location.href='/user/index'; </script>";
The alert contains the prompt message, and the href is the page to jump to after the prompt.
Later, I remembered that there is a redirect() redirection method in the TP framework, so I went to check it out.
However, TP does not come with a pop-up window, so it was modified to:
$url="http://www.jbxue.com";
echo "<script> alert('no loginid'); </script>";
<em id="__mceDel">echo "<meta http-equiv='Refresh' content='0;URL=$url'>";</em>
$url is the page to be jumped. At the same time, this can also control the jump time. The 0 after content means that the page will jump after 0 seconds.
Two direct jump methods:
header("Location:".PSYS_BASE_URL."user/index"); 和 header("refresh:{$time};url={$url}");
These two methods will jump directly without prompt. The following one is recommended.
Finally, there is another problem. The jump code is always followed by a return, because the following statements will also be executed.