_php techniques for using functions in thinkphp3.0 templates

Source: Internet
Author: User
The source of the variable:

1 variables assigned from PHP, using assign Assignment
2 System Variables
3 Path Substitution variables
Cannot use variable of function
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 parameters and {$Think. Config.var} are equivalent
{%var}//Output language variable and {$Think. Lang.var} are equivalent
{. var}//output get variable and {$Think. Get.var} equivalent
{^var}//output post variable and {$Think. Post.var} equivalent
{*var}//output constants and {$Think. Const.var} are equivalent
{@var1. var2}//output $_session[' var1 '] [' var2 ']
{#var1. var2}//output $_cookie[' var1 '] [' var2 ']

One converted to uppercase {$title |strtoupper}

The function call format for the template variable is:

Copy Code code as follows:

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


Description
{and $ symbol can not have spaces between the following parameters of the space is no problem # # #表示模板变量本身的参数位置 support multiple functions, function support space support function, in the configuration file can be configured to prohibit the use of the list of functions to support the variable caching function, repeated variable string not multiple resolution
Use Example: X
Copy Code code 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.