search
Homephp教程php手册ThinkPHP使用smarty模板引擎的方法

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模板了。

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

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software