Home  >  Article  >  Backend Development  >  The use of u method in tp, the use of tpu method_PHP tutorial

The use of u method in tp, the use of tpu method_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:09:491006browse

Using the u method in tp, using the tpu method

I didn’t use 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'));
<span>1 //</span><span>跳转时带着参数的话</span>
<span>2 $this</span>->success('新增成功',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 parameter settings change, you do not need to change any code in the template.

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

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/941172.htmlTechArticleThe use of u method in tp and tpu method. I have never used this method when I was self-study. I just entered now. A new company joins the project. I found that this method is used a lot, so I recorded it...
Statement:
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