Smarty是php的半官方模板引擎,从其主页位置就可以看出。使用简单,功能强大,本文就介绍一下smarty模板的安装和使用。
1) 现在模板的安装包,解压到根目录外的某个位置,比如解压到c:phpLibsmarty
2)修改 php.ini文件,配置include_path。 如此文中的配置为:include_path="c:phpLibsmartylibs"
注意,要把include_path前的分号去掉
3) 创建存放模板文件和配置文件的四个目录
templates 存放模板文件的目录
template_c 防止smarty编译的模板文件
configs 放置专用的配置文件目录
cache 在启用缓存的情况下,放置smarty缓存的所有文件
4)在php脚本使用smarty模板前,先制定上述四个目录的位置:
$smarty = new Smarty;
$smarty->template_dir = "templates";
$smarty->compile_dir = "template_c";
$smarty->config_dir = "configs";
$smarty->cache_dir = "cache";
?>
完成上述四个步骤后,就可以使用smarty模板了

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment