Home >Backend Development >PHP Tutorial >Examples of how to use functions in thinkPHP templates_php examples
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:
Method usage in1.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 templates
{sh:$member.tel|substr_replace="*****",3,5} {sh:$member.addtime|date="Y-m-d H:i",###}
If the variable is the first parameter, no ### is needed.
If it is not the first one, use ### to mark the position.
Readers who are interested in more thinkPHP related content can check out the special topics of this site: "ThinkPHP Getting Started Tutorial", "ThinkPHP Template Operation Skills Summary", "ThinkPHP Common Methods Summary", "php Common Functions and Skills Summary", "smarty Templates" Basic Tutorial for Getting Started" and "Summary of PHP Template Technology".
I hope that what is described in this article will be helpful to everyone’s PHP program design based on the ThinkPHP framework.