This article mainly introduces the use of functions in thinkPHP templates, and compares and analyzes the use of PHP functions alone and the corresponding usage skills of PHP functions in thinkPHP templates in the form of examples. Friends in need can refer to the following
The examples in this article describe how to use functions in thinkPHP templates. Share it with everyone for your reference, the details are as follows:
1. Use the method in php
<?php $var_num = "13966778888"; $str = substr_replace($var_num,'*****',3,5); echo $str; $var_date = time(); $str = date("Y-m-d H:i",$var_date); echo $str; ?>
2. Use in the template
{sh:$member.tel|substr_replace="*****",3,5} {sh:$member.addtime|date="Y-m-d H:i",###}
If the variable is the first parameter , there is no need for
. If it is not the first one, useto mark the position.
thinkPHP template arithmetic operation related function usage analysis### ###
The above is the detailed content of Examples of how to use functions in thinkPHP templates. For more information, please follow other related articles on the PHP Chinese website!