Analysis of redirect usage in thinkphp

Source: Internet
Author: User
This article mainly introduces the usage of redirect in thinkphp, the example analyzes the various common operation techniques of redirect redirection, has certain practical value, the need of friends can refer to the following

The examples in this paper describe the redirect usage in thinkphp. Share to everyone for your reference. The specific analysis is as follows:

The general syntax for redirect redirection is: Redirect (Url,params=array (), delay=0,msg= "), assuming the current default home grouping aritcle module insert operation, some examples are as follows:

Copy the Code code as follows:

Jump to edit Operation   $this->redirect (' edit ');  Jump to the edit operation under Useraction   $this->redirect (' User/edit ');  Jump to Admin group default module default action  $this->redirect (' admin/');//Jump to Admin Group Index Module View Operation  $this->redirect (' Admin-index/view ');  Jump to Admin group Index Module View operation, uid parameter is 1, delay 3 seconds jump  $this->redirect (' Admin-index/view ', Array (' UID ' =>1), 3, ' page jump in ~ ')  //Jump to other Otherapp items (non-grouped) Admin project group User Module View Operation   $this->redirect (' Otherapp://admin-user/view ');

As with URL access in a project group, a cross-grouping jump in redirect is just the concept of a grouped item name.

Tip: You can use routing in redirect, and the parameter usage of the redirect method is consistent with the use of the U function. You can refer to the U function to generate the relevant part of the URL address.

Related recommendations:

Example of thinkphp R method

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.