: 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.