Smarty安装配置方法_php技巧

WBOY
Release: 2016-05-17 09:37:24
Original
940 people have browsed it

下载最新的Smarty:http://smarty.php.net/
当前最新版本:2.6.18
解压后将目录中的libs目录重命名为smarty,复制到你的网站目录,同时在网站根目录下建立templates和templates_c两个目录
建立test.php,内容如下:
include_once('./Smarty/Smarty.class.php');$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //模板存放目录
$smarty -> compile_dir = "./templates_c"; //编译目录
$smarty -> left_delimiter = "{{"; //左定界符
$smarty -> right_delimiter = "}}"; //右定界符
$smarty -> assign('test','OK');
$smarty -> display('test.html');
?>
给templates_c权限755

在templates目录下新建test.html:




{{$test}}


打开test.php,如果看到OK就说明你的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
Popular Tutorials
More>
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!