This article mainly introduces the redirect usage in ThinkPHP. The example analyzes various common redirect redirection operation skills and has some practical value. For more information, see
This article mainly introduces the redirect usage in ThinkPHP. The example analyzes various common redirect redirection operation skills and has some practical value. For more information, see
This example describes the redirect usage in ThinkPHP. Share it with you for your reference. The specific analysis is as follows:
The general syntax of redirect redirection is redirect (url, params = array (), delay = 0, msg = ''). Assume that the insert operation is performed on the Aritcle module of the default HOME group, some examples are as follows:
The Code is as follows:
// Jump to the edit operation
$ This-> redirect ('edit ');
// Jump to the edit operation under UserAction
$ This-> redirect ('user/edit ');
// Jump to the Admin group default module default operation
$ This-> redirect ('admin /');
// Jump to the view operation of the Index module of the Admin group
$ This-> redirect ('admin-Index/view ');
// Jump to the view operation of the Index module of the Admin group. The uid parameter is 1 and the jump is delayed by 3 seconds.
$ This-> redirect ('admin-Index/view', array ('uid' => 1), 3, 'page Jump in progress ~ ')
// Jump to the view operation of the Admin project group User module of another OtherApp Project (non-group)
$ This-> redirect ('otherapp: // Admin-User/view ');
Similar to URL access in a project group, cross-group jump in redirect Only adds the concept of a group project name.
Tip: You can use routes in redirect. The parameter usage of the redirect method is the same as that of the U function. Refer to the URL generated by the U function.
I hope this article will help you with ThinkPHP-based PHP programming.