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:
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.