首页 > 其他 > 详细

新浪云使用smarty模板的方法

时间:2017-06-28 10:38:57      阅读:309      评论:0      收藏:0      [点我收藏+]

在部署到sina app engine(sae)上时出现了问题,因为sae作为云计算平台式无法进行文件读写操作的,所以Smarty中输出的缓存文件就无法实现。

错误信息:“SAE_Fatal_error: Uncaught exception ‘SmartyException‘ with message ‘unable to write file ./web/templates_c/wrt4e95555280ef1‘ ”

SAE给出了解决方案就是使用Memcache。首先进入应用中的应用管理中,在服务管理中开启Memcache一个初始化,

技术分享

 

 

然后修改Smarty的配置文件:

// For SAE 编译文件存放在memcache中
$smarty->compile_dir = ‘saemc://smartytpl/‘;
$smarty->cache_dir = ‘saemc://smartytpl/‘;
$smarty->compile_locking = false; // 防止调用touch,saemc会自动更新时间,不需要touch

上面三行是必须的。

这样Smarty模板就可以在SAE上运行了。

 

新浪云使用smarty模板的方法

原文:http://www.cnblogs.com/web-fusheng/p/7088460.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!