Use of the u method in tp

Source: Internet
Author: User
: This article mainly introduces the use of the u method in tp. if you are interested in the PHP Tutorial, please refer to it. I have never used this method during my self-study. now I am entering a new company to participate in the project. This method is often used, so it should be recorded to prevent future forgetting.

The U method is used to assemble the URL address. the feature is that the corresponding URL address can be automatically generated based on the current URL mode and settings. the format is:

U ('address', 'parameters', 'pseudo-static ', 'redirect?', 'display domain name ');

1 // for example, the operation is successfully redirected to the lists method 2 $ this-> success ('newly added success', U ('strore/Ump/lists') in the Ump controller of the Store module '));

1 // 2 $ this-> success ('added successfully', U ('store/Ump/lists ', 'type = 1 & id = 1 '));

When using the U method in a template, the advantage is that once your environment changes or the parameter settings change, you do not need to change any code in the template.

The call format in the template must use {: U ('address', 'parameters '...)} Method

 {: U ('store/Ump/lists', 'type = 1 & id = 1 ')}

The above describes the use of the u method in tp, including the content, hope to be helpful to friends interested in PHP tutorials.

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.