thinkphp Template Output Tips Summary _php instance

Source: Internet
Author: User

This article summarizes the thinkphp template output techniques. Share to everyone for your reference. The concrete summary is as follows:

Output of variable (emphasis)

1. Scalar output:

Copy Code code as follows:
{$name}

2. Array output

Copy Code code as follows:
{$name [0]}
{$name [' K2 ']}
{$name. K1}

3. Object output

Copy Code code as follows:
{$name: k}//calls this object's member property K
{$name->k}//traditional call k method

second, System variables
Copy Code code as follows:
{$Think. get.id}//call the system variable in the template and get the supplied ID value

Third, the use of functions

Copy Code code as follows:
{$name |strtoupper} generates a compiled file that is

{$name |date= ' Y m D h:i:s ', ###}//full # is the point meaning, representing the previous variable $name

Four, the default value

Copy Code code as follows:
{$name |default= ' here is the default value '}//if the value does not exist, use the default value

Five, operator

Copy Code code as follows:
Common operators: +-*/% + +-
{$name +1}

I hope this article will be helpful to everyone's thinkphp framework program design.

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.