Use of functions in the thinkphp3.0 Template

Source: Internet
Author: User
Use of functions in the thinkphp3.0 template, not all variables can use the source of function variables:

1. Use assign to allocate the variables allocated from php.
2. system variables
3. path replacement variable
Function variables cannot be used.
Variable output shortcut label
{@ Var} // The output Session variable is equivalent to {$ Think. session. var }.
{# Var} // The Cookie output variable is equivalent to {$ Think. cookie. var }.
{& Var} // The output configuration parameter is equivalent to {$ Think. config. var }.
{% Var} // The output language variable is equivalent to {$ Think. lang. var }.
{. Var} // The output Get variable is equivalent to {$ Think. get. var }.
{^ Var} // The output POST variable is equivalent to {$ Think. post. var }.
{* Var} // The output constant is equivalent to {$ Think. const. var }.
{@ Var1.var2} // Output $ _ SESSION ['var1'] ['var2']
{# Var1.var2} // Output $ _ COOKIE ['var1'] ['var2']

Convert to uppercase {$ title | strtoupper}

The function call format of template variables is:

Copy codeThe code is as follows:
{$ Varname | function1 | function2 = arg1, arg2 ,###}


Note:
{There is no space between the symbol and the $ symbol, and there is no problem with the space of the following parameter ### it indicates that the parameter location of the template variable itself supports multiple functions, and the space between functions supports the function shielding function, in the configuration file, you can configure the disabled function list to support variable caching. repeated variable strings are parsed several times.
Example: X
Copy codeThe code is as follows:
{$ WebTitle | md5 | strtoupper | substr = 0, 3}

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.