Heim  >  Artikel  >  Backend-Entwicklung  >  ThinkPHP使用smarty模板引擎的方法_PHP教程

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

WBOY
WBOYOriginal
2016-07-13 10:26:24829Durchsuche

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'

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

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

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

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

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/824706.htmlTechArticleThinkPHP支持多种php模板引擎,可以根据个人需要加以配置。 下面我们以Smarty模板引擎为例,给大家说说具体的操作流程! 首先去Smarty官网上...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn