This article mainly introduces the usage of redirect in ThinkPHP. It analyzes various common operation techniques of redirection with examples. It has certain practical value. Friends in need can refer to it.
This article explains the examples of ThinkPHP Medium redirect usage. Share it with everyone for your reference. The specific analysis is as follows:
redirect The general syntax of redirection is: redirect(url,params=array(),delay=0,msg=''), assuming that the current is the default HOME group Aritcle module insert operation, some The example is as follows:
Copy code The code is as follows:
// 跳转到 edit 操作 $this->redirect('edit'); // 跳转到 UserAction下的edit 操作 $this->redirect('User/edit'); // 跳转到 Admin分组默认模块默认操作 $this->redirect('Admin/'); // 跳转到 Admin分组Index模块view操作 $this->redirect('Admin-Index/view'); // 跳转到 Admin分组Index模块view操作,uid参数为1,延迟3秒跳转 $this->redirect('Admin-Index/view', array('uid'=>1), 3,'页面跳转中~') // 跳转到 其他OtherApp项目(非分组)的Admin项目分组User模块view操作 $this->redirect('OtherApp://Admin-User/view');
The same as the URL access in the project group, the cross-group jump in redirect just has one more group The concept of project name.
Tips: Routing can be used in redirect. The parameter usage of the redirect method is consistent with the usage of the U function. You can refer to the relevant parts of the U function to generate URL addresses.
Related Recommended:
The above is the detailed content of Analysis of redirect usage in ThinkPHP. For more information, please follow other related articles on the PHP Chinese website!