Examples of how to use functions in thinkPHP templates

不言
Release: 2023-03-25 16:28:01
Original
1735 people have browsed it

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,&#39;*****&#39;,3,5);
  echo $str;
  $var_date = time();
  $str  = date("Y-m-d H:i",$var_date);
  echo $str;
?>
Copy after login

2. Use in the template

{sh:$member.tel|substr_replace="*****",3,5}
{sh:$member.addtime|date="Y-m-d H:i",###}
Copy after login

If the variable is the first parameter , there is no need for

.

If it is not the first one, use

to mark the position.

Related recommendations:

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!