Home  >  Article  >  Backend Development  >  The use of functions in thinkphp3.0 template_PHP tutorial

The use of functions in thinkphp3.0 template_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:14:29813browse

Sources of variables:

1 Variables assigned from php, use assign to assign
2 System variables
3 Path replacement variables
Variables of functions cannot be used
Variable output shortcut tags
{@var}//The output Session variable is equivalent to {$Think.session.var}
{#var}//The output Cookie variable is equivalent to {$Think.cookie.var}
{&var} //The output configuration parameters are equivalent to {$Think.config.var}
{%var}//The output language variables are equivalent to {$Think.lang.var}
{.var}//Output Get Variables are equivalent to {$Think.get.var}
{^var}//Output POST variables are equivalent to {$Think.post.var}
{*var}//Output constants and {$Think .const.var}Equivalent
{@var1.var2}//Output $_SESSION['var1']['var2']
{#var1.var2}//Output $_COOKIE['var1'] ['var2']

converted to uppercase {$title|strtoupper}

The function calling format of template variables is:

Copy the code The code is as follows:

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


Instructions: There can be no spaces between
{ and $ symbols, and there will be no problem with spaces in the following parameters. ### means that the parameter position of the template variable itself supports multiple functions, and spaces between functions support function masking function, which can be used in the configuration file Configure the list of prohibited functions to support the variable caching function. Repeated variable strings will not be parsed multiple times
Usage example: 🎜>
{$webTitle|md5|strtoupper|substr=0,3}
http://www.bkjia.com/PHPjc/326312.html

www.bkjia.com
true

http: //www.bkjia.com/PHPjc/326312.htmlTechArticleSource of variables: 1 Variables assigned from php, assigned using assign 2 System variables 3 Path replacement variables cannot use functions Variable variable output shortcut tag {@var}//Output Session variables and...
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