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:
The 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
The code is as follows:
{$ WebTitle | md5 | strtoupper | substr = 0, 3}