ThinkPHP使用smarty模板引擎的方法_PHP教程

WBOY
Release: 2016-07-13 10:26:24
Original
807 people have browsed it

ThinkPHP支持多种php模板引擎,可以根据个人需要加以配置。
下面我们以Smarty模板引擎为例,给大家说说具体的操作流程!

首先去Smarty官网上下载一个Smarty。本站下载地址:http://www.jb51.net/codes/16086.html。
接下来解压压缩包,会有两个文件夹:demo和libs。打开libs文件夹,复制所有内容。
接下来,打开你网站根目录 下thinkphp的文件夹。里面有个vendor文件夹,这个文件夹是TP调用第三方类库用的,把刚才复制的东西全部粘贴过来。
之后打开 你项目的配置文件,应该在你项目目录 的conf目录下conf.php这个文件。

加上如下配置:

'TMPL_ENGINE_TYPE'=>'Smarty'
Copy after login

如果 你想配置的更多,你还可以 加上

'TMPL_ENGINE_CONFIG'=>array( 'caching'=>true, 'template_dir'=>TMPL_PATH, 'compile_dir'=>CACHE_PATH, 'cache_dir'=>TEMP_PATH )
Copy after login

这样你就可以使用Smarty模板了。

模板的文件位置没有变,缓存位置也没有变。

www.bkjia.com true http://www.bkjia.com/PHPjc/824706.html TechArticle ThinkPHP支持多种php模板引擎,可以根据个人需要加以配置。 下面我们以Smarty模板引擎为例,给大家说说具体的操作流程! 首先去Smarty官网上...
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!