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

thinkphp 自定义函数及使用方法

WBOY
WBOYOriginal
2016-06-01 09:46:501093browse

实例:

 

第一步:将自定义函数放在项目应用目录/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>

 

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

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

 

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