Use of functions in the thinkphp3.0 template. Source of the variable: 1 variable allocated from php, use assign to allocate 2 system variable 3 Path to replace variable cannot use function variable output shortcut label {@ var} output Session variable and variable Source:
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}
Variables allocated from php in container 1 are allocated using assign. 2 system variables 3 path replacement variables cannot be used as function variables output shortcut labels {@ var} // output Session variables and...