What is the method to implement prompt jump in php?

王林
Release: 2023-03-07 12:32:02
Original
1667 people have browsed it

The way PHP implements prompt jump is: first, in the automatic loading of MVC, automatically load and register the basic controller class; then inherit the basic controller class through different controller classes; finally call the defined jump Just forward the prompt.

What is the method to implement prompt jump in php?

In PHP development, especially in MVC frameworks or projects, you will encounter many jump situations, such as jumps after successful or failed login, etc. wait.

(Learning video recommendation:java course)

The following is based on the development of the MVC framework, with examples:

In the basic controller class: Conrtoller.class.php

 提示信息  

提示信息

$info
页面在$time秒后会自动跳转,或点击立即跳转

TIAOZHUAN; die; } } }
Copy after login

In the automatic loading of MVC, Controller.class.php is automatically loaded and registered

Inherit the above basic control of Controller.class.php through different controller classes After adding the handler class, 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','您已退出后台登录!'); } }
Copy after login

Of course, this is implemented in MVC, you can also use jump() separately.

Attached is a rendering:

What is the method to implement prompt jump in php?

Related recommendations:php training

The above is the detailed content of What is the method to implement prompt jump in php?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!