The examples in this article describe the thinkphp template engine usage. Share to everyone for your reference, specific as follows:
1.if
<if condition= "$vo. Business eq LS" >
retail
<elseif condition= "$vo. Business eq CY"/>
Catering
< else/>
other
</if>
After compiling
<?php
if ($vo ["business"] = LS):
?> retail
<?php
elseif ($vo ["business"] = CY):
?> Catering
<?php
Else:
?> other <?php
endif;
? >
2. Using functions
{sh: $vo. Time|default=time () |date= ' y-m-d h:i:s ', ###}
After compiling
<?php Echo (' y-m-d h:i:s ', ($vo [Time])? ( $vo ["Time"]): Time ());?>
Usually the first parameter of a function is the return result of the previous variable or previous function call, and if your variable is not the first argument of the function, you need to use the anchor symbol, for example:
{$create _time|date= "y-m-d", ###}
After compiling
<?php Echo (Date ("y-m-d", $create _time));?>
3. Default value
{$user. nickname|default= "This guy is lazy, he left nothing."}
After compiling
<?php Echo ($user ["nickname"])? ($user ["nickname"]): ' This guy is lazy, he left nothing ';?>
More interested readers of thinkphp related content can view the website topic: "thinkphp Introductory Course", "thinkphp template Operation Skill Summary", "thinkphp Common Method Summary", "The CodeIgniter Introductory Course", "CI ( CodeIgniter) Framework Advanced tutorials, introductory tutorials for the Zend framework Framework, Smarty Templates Primer tutorial, and PHP template technology summary.
I hope this article will help you with the PHP program design based on thinkphp framework.