Home > Backend Development > PHP Tutorial > Use of u method in tp

Use of u method in tp

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-08-08 09:31:28
Original
1343 people have browsed it

I have never used this method much when I was studying on my own, and now I have just joined a new company to participate in a project. I found that this method is used a lot, so I recorded it to prevent forgetting it later.

The

U method is used to complete the assembly of URL addresses. Its feature is that it can automatically generate the corresponding URL address based on the current URL mode and settings. The format is:

U('Address', 'Parameters', 'Pseudo-static', 'Whether to jump', 'Display domain name');

<span>1</span> <span>//</span><span>比如操作成功跳转到Store模块下的Ump控制器中的lists方法</span>
<span>2</span> <span>$this</span>->success('新增成功',U('Strore/Ump/lists'));
Copy after login

<span>1 //</span><span>跳转时带着参数的话</span>
<span>2 $this</span>->success('新增成功',U('Store/Ump/lists','type=1&id=1'));
Copy after login

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

The calling format in the template needs to be in the form of {:U('address', 'parameter'...)}

<span><!--</span><span>在模板中使用U方法 </span><span>--></span><span>
{:U('Store/Ump/lists','type=1</span><span>&id</span>=1')}
Copy after login

The above introduces the use of the u method in tp, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Python two lists added
From 1970-01-01 08:00:00
0
0
0
java - bean collection split into multiple lists
From 1970-01-01 08:00:00
0
0
0
Nested lists in different styles
From 1970-01-01 08:00:00
0
0
0
python - Merge multiple lists into a dictionary
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template