Home  >  Article  >  Backend Development  >  Examples of how to use functions in thinkPHP templates_php examples

Examples of how to use functions in thinkPHP templates_php examples

WBOY
WBOYOriginal
2016-12-05 13:28:241077browse

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 in

1.php

<&#63;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;
&#63;>

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.

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