Thinkphp Template Call Function method

Source: Internet
Author: User
Tags timestamp to date

Original: thinkphp template Call function method

{variable | function 1| function 2| function 3 = parameter 1, parameter 2, parameter 3,###}

# # #为第4个参数, replace the variable with the 4th parameter

Example:

{$username |substr=0,3} takes the first 3 characters in the header

{$times |date= ' y-m-d h:i:s ', # # #} convert times timestamp to date format

==================================================

Use of the colon execution function: Output method and execute return value

{: U (' User/insert ')}

Example:

{: Time ()} will output the current date format and will be parsed into <?php echo time ();?>

==================================================

Usage of wavy Line function: Execute method but not output

{~function ()}

Example:

{~substr ("Aaaaaaa", 3)} does not output after execution, the back is parsed into <?php substr?>

============================================

{$Think The Get-over parameter in Get.url}

{$Think a variable in Server.server}

{$Think. Session.session in Id|md5} You can MD5 the value if you want.

{$Think. ID in Cookie.cookie}

=============

{$Think. config.db_host} read configuration information in config

{($title)? ($title): ' No value currently '} If no value is present, the following description is displayed

==================

<switch name= "" >

<case value= "1" >aaaaaa</case>

<case value= "2" >bbbbbbbbb</case>

<default/> No data

</switch>

===============

<eq name= "A" value= "3" >a equals 3<else/>a not equal to 3</eq>

<eq name= "A|strlen" value= "1" >a length equals 1<else/>a length not equal to 1</eq>

=================

<in name= "A" value= "1,2,3,4" > variable a value printed in 1,2,3,4 range </in>

<notin name= "A" value= "1,2,3,4" > variable a value does not print in 1,2,3,4 range </notin>

or with

<range name= "A" value= "1,2,3,4" type= "in" >a within 1,2,3,4 range </range>//type to notin or not, this method can replace in and Notin

===============

<empty name= "A" >a variable is empty </empty>

<notempty name= "A" >a variable is not empty </notempty>

Thinkphp Template Call Function method

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.