Home > php教程 > php手册 > thinkphp 自定义函数及使用方法

thinkphp 自定义函数及使用方法

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 09:46:50
Original
1163 people have browsed it

实例:

 

第一步:将自定义函数放在项目应用目录/common/common.php 或/common/function.php中。

<code class="language-php">function Cate($cid){ 
   $Cate=D('Cate'); 
   $Cate=$Cate->where('id='.$cid)->find(); 
   return $Cate['title']; 
} </code>
Copy after login

 

第二步:在模板中按照以下方法使用。

<code class="language-php">{$vo.cid|cate=###} </code>
Copy after login

 

Related labels:
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
Latest Issues
Why thinkphp has better performance than laravel?
From 1970-01-01 08:00:00
0
0
0
ThinkPHP Why use composer?
From 1970-01-01 08:00:00
0
0
0
thinkphp versions supported by php6
From 1970-01-01 08:00:00
0
0
0
thinkphp upload files
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template