smarty 入门2(个人总结)

1、下载安装;

2、拷贝libs文件夹到web文件夹;

3、引入smarty类文件   // include './libs/Smarty.class.php';   

4、配置smarty      //a、配置模板文件 $smarty -> setTemplateDir("./mb/")  ; 

                          //b、配置编译后的文件 $smarty -> setCompileDir('./by/');

5、写入PHP代码 //a、将数据库发送到模板$smarty->assign("mb_str",$a);          *mb_str模板变量

                         b、引入模板文件$smarty -> display(qt.html);      *qt.html前端html

注意:

切记utf-8格式,中文乱码,前端页面挖坑{};

原文地址:https://www.cnblogs.com/panlaixing/p/5825058.html