Chinaunix首页 | 论坛 | 博客
  • 博客访问: 49579
  • 博文数量: 62
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 350
  • 用 户 组: 普通用户
  • 注册时间: 2015-01-06 11:17
文章分类
文章存档

2015年(62)

我的朋友

分类: PHP

2015-03-25 09:53:49

"font-size:18px;">Smarty 技术的使用
#smarty 测试 #引入smarty 
require_once "./smarty/Smarty.class.php"; #必须加载该类文件 #生成一个smarty对象 $smarty = new Smarty(); #设置smarty $smarty->left_delimiter='{'; #左修饰符 $smarty->right_delimiter='}'; #右修饰符 $tpl=$smarty->template_dir ="./libs/view/template"; #模板文件 $smarty->_dir ="./libs/view/cache"; #文件 $smarty->compile_dir ="./libs/view/template_c"; #编译文件 $smarty->caching = true; #开启缓存 $smarty->cache_lifetime = 100; #缓存生命周期 #使用模板方法 $smarty->assign('test','this is testSmarty!'); #进行赋值 $smarty->display("index.tpl"); #输出 (必须在指定的目录下存在该文件,文件中用{$test} 表示以上赋值的&quo;test’)
  • 本文来自:
阅读(250) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~