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

Examples of how to use functions in thinkPHP templates_php examples

WBOY
Release: 2023-03-03 07:00:01
Original
1101 people have browsed it

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;>

Copy after login

2. Use in templates

{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, 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.

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