Home>Article>Backend Development> Sample code for implementing simple jump prompts in PHP
The content of this article is about the sample code for implementing simple jump prompts in virtual PHP. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
In PHP development, especially in MVC frameworks or projects, you will encounter many jump situations, such as jumps after successful or failed login, etc.
The following is based on the MVC framework development, with examples:
In the basic controller class: Conrtoller.class.php
提示信息 TIAOZHUAN; die; } } }提示信息
$info
页面在$time秒后会自动跳转,或点击立即跳转
In the automatic loading of MVC, Automatically load and register Controller.class.php
After inheriting the above Controller.class.php basic controller class through different controller classes, you can call the defined jump prompt.
display('login.html'); } /** * 后台注销功能 */ public function logoutAction() { @session_start(); // 删除相关会话数据 unset($_SESSION['adminInfo']); // 删除会话数据区 session_destroy(); // 立即跳转到登录页面 $this->jump('index.php?c=Admin&a=login','您已退出后台登录!'); } }
Of course, this is implemented in MVC, you can also use jump() separately.
Attached is a rendering:
The above is the detailed content of Sample code for implementing simple jump prompts in PHP. For more information, please follow other related articles on the PHP Chinese website!