First explain, the relationship between page jump and page redirection?
Page redirection must have page jump, page jump does not necessarily have page redirection, that is to say, page redirection is really included in page jump, and page redirection is not sufficient for page jump. Necessary conditions.
Below we introduce several methods to obtain the redirect url:
1 Use js to implement
The code is as follows:
if(!$this->userInfo){ $alert_msg = "激活链接错误"; echo"<SCRIPT LANGUAGE='javascript'>alert('$alert_msg');window.location='$redirect_url';</SCRIPT>"; //redirect(base_url()); die; }
2 php The code to implement
is as follows:
if(!$this->userInfo){ $alert_msg = "激活链接错误"; echo"<SCRIPT LANGUAGE='javascript'>alert('$alert_msg');</SCRIPT>";//这种方式没有弹窗效果 why? 加上exit 会有弹窗,后续也会重定向; redirect(base_url()); die; }
The above is the detailed content of PHP pop-up dialog box to implement redirection sample code. For more information, please follow other related articles on the PHP Chinese website!