Redirect Usage Analysis in ThinkPHP

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.