ThinkPHP framework allows page redirection method summary

php中世界最好的语言
Release: 2023-03-26 07:06:02
Original
2208 people have browsed it

This time I will bring you ThinkPHP frameworkA summary of the page redirection method, ThinkPHP framework to redirect the pageWhat are the precautions for the methodThe following is a practical case, one Get up and take a look.

ThinkPHP redirect method

ThinkPHP redirect method can realize the redirection (jump) function of the page. The redirect method syntax is as follows:

$this->redirect(string url, array params, int delay, string msg)

Parameter description:

Parameters Description
url Required, redirect URL expression.
params Optional, other URL parameters.
delay Optional, redirection delay, unit is seconds.
msg Optional, redirect prompt information.

ThinkPHP redirect example

In the Index module index method, redirect to the select operation of this module:

class IndexAction extends Action{
public function index()
{
 $this->redirect('select', array('status'=>1), 3, '页面跳转中~'); //3秒
}
}
Copy after login

Some commonly used redirect examples:

// 不延时,直接重定向
$this->redirect('select', array('status'=>1));
// 延时跳转,但不带参数,输出默认提示
$this->redirect('select', '', 3);
// 重定向到其他模块操作
$this->redirect('Public/login');
// 重定向到其他分组
$this->redirect('Admin-Public/login');
Copy after login

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the PHP Chinese website!

Recommended reading:

CodeIgniter uses redis steps to explain in detail

PHP programming to implement TCP server and client functions in detail

The above is the detailed content of ThinkPHP framework allows page redirection method summary. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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
Popular Tutorials
More>
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!