The use of functions in thinkphp3.0 templates

  • 2020-05-26 08:07:17
  • OfStack

Source of variables:

1 a variable assigned from php, using assign
2 system variables
3 path substitution variables
You cannot use variables of functions
Variable output shortcut label
{@var}// output Session variable and {$Think.session.var} equivalent
{#var}// output Cookie variable and {$Think.cookie.var} equivalent
{ & var}// output configuration parameter and {$Think.config.var} are equivalent
{%var}// output language variables and {$Think.lang.var} equivalent
{.var}// output Get variable and {$Think.get.var} equivalent
{^var}// output POST variable and {$Think.post.var} equivalent
{*var}// output constant and {$Think.const.var} equivalent
{@ var1. var2} / / output $_SESSION [' var1] [' var2]
{# var1. var2} / / output $_COOKIE [' var1] [' var2]

Convert 1 to uppercase {$title|strtoupper}

The function call format of the template variable is:

 
{$varname|function1|function2=arg1,arg2,### } 


Description:
{and there can be no Spaces between the $symbol, the parameter space, there is no problem # # # is the location of the parameters of the template variable itself to support multiple functions, function support Spaces between shielding function, support function in the configuration file can be configured to ban the use of the function list support variable cache function, repeat variable string parsing for many times
Use example: X
 
{$webTitle|md5|strtoupper|substr=0,3} 

Related articles: