ThinkPHP使用Smarty
2015-09-13 22:51
666 查看
如果是使用核心版的话,将Smarty文件夹放置在/ThinkPHP/Library/Vendor中
然后配置Application/Home/Conf/config.php
return array(
//'配置项'=>'配置值'
'TMPL_ENGINE_TYPE'=>'Smarty' ,
'TMPL_ENGINE_CONFIG'=>array(
'left_delimiter'=>'{{', //左分界符
'right_delimiter'=>'}}' //右分界符
),
);
Application\Home\Controller\IndexController.class.php 中写代码
新建模板 :Application\Home\View\Index\index.html
然后配置Application/Home/Conf/config.php
return array(
//'配置项'=>'配置值'
'TMPL_ENGINE_TYPE'=>'Smarty' ,
'TMPL_ENGINE_CONFIG'=>array(
'left_delimiter'=>'{{', //左分界符
'right_delimiter'=>'}}' //右分界符
),
);
Application\Home\Controller\IndexController.class.php 中写代码
namespace Home\Controller; use Think\Controller; class IndexController extends Controller { public function index(){ $name="张三"; $this->assign("name",$name); $this->display(); } }
新建模板 :Application\Home\View\Index\index.html
<!doctype html> <html lang="zh-cn"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>ThinkPHP测试</title> </head> <body> 姓名:{{$name}} </body> </html>
相关文章推荐
- kindeditor 批量上传 上传失败 thinkphp swfupload session
- ThinkPHP关联模型操作实例分析
- php中Smarty模板初体验
- thinkphp3.0 模板中函数的使用
- ThinkPHP采用<volist>实现三级循环代码实例
- 解析smarty 截取字符串函数 truncate的用法介绍
- smarty巧妙处理iframe中内容页的代码
- 关于PHP模板Smarty的初级使用方法以及心得分享
- Thinkphp模板标签if和eq的区别和比较实例分析
- php使用Smarty的相关注意事项及访问变量的几种方式
- php smarty的预保留变量总结
- 合并ThinkPHP配置文件以消除代码冗余的实现方法
- smarty缓存用法分析
- ThinkPHP中自定义目录结构的设置方法
- smarty 原来也不过如此~~呵呵
- ThinkPHP控制器详解
- Smarty Foreach 使用说明
- ThinkPHP自动转义存储富文本编辑器内容导致读取出错的解决方法
- PHP详细彻底学习Smarty
- 解析thinkphp中的M()与D()方法的区别