Home >Backend Development >PHP Tutorial >How to use functions in thinkPHP templates

How to use functions in thinkPHP templates

墨辰丷
墨辰丷Original
2018-05-30 09:53:081953browse

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

1. Method usage 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;
?>


##2. Usage in template


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


If the variable is the first parameter,

is not needed.

If it is not the first one, use

to mark the position.


The above is the entire content of this article, I hope it will be helpful to everyone's study.


Related recommendations:

phpValue passing method and ajax method to implement verification function

phpMethod to implement message board function

App messaging in Redis Detailed explanation

Detailed explanation of application messaging of Redis in php

The above is the detailed content of How to use functions in thinkPHP templates. For more information, please follow other related articles on the PHP Chinese website!

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