Redirect in TP5 implements redirection and jump with parameters
The following tutorial column will introduce you to the redirect method in TP5 to implement redirection and jump with parameters. I hope it will be helpful to friends in need! Redirection
The redirect method of the \think\Controller class can implement the redirection function of the page. The parameter usage of the redirect method is consistent with the usage of the Url::build method (refer to the URL generation part). For example:
//重定向到News模块的Category操作 $this->redirect('News/category', ['cate_id' => 2]);
The above usage is to jump to the category operation of the News module. Re- The current URL address will be changed after orientation.
Or redirect directly to a specified external URL address, for example:
//重定向到指定的URL地址 并且使用302 $this->redirect('http://thinkphp.cn/blog/2',302);
can be used when redirecting Pass values through session flash memory data, for example $this->redirect('News/category', ['cate_id' => 2], 302, ['data' => 'hello']);
redirect('News/category')->remember();
You need to jump to the last time When remembering the URL, use:
redirect()->restore();
Front-end reference
href="{:url(url,data)}
Back-end page jump
For example:
$this->success('批量数据添加成功', url('DataManagement/dataStatus',$data3));
The above is the detailed content of Redirect in TP5 implements redirection and jump with parameters. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

