新浪SAE中如何使用smarty模板

来源:互联网 发布:大非农数据白银 编辑:程序博客网 时间:2024/05/16 13:41

新浪SAE中如何使用smarty模板

sae作为云计算平台式无法进行文件读写操作的,所以Smarty中输出的缓存文件就无法实现。

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

SAE给出了解决方案就是使用Memcache。

1、进入应用中的应用管理中,在服务管理中开启Memcache一个初始化

2、修改Smarty的配置文件:

// For SAE 编译文件存放在memcache中
smarty>compiledir=saemc://smartytpl/;smarty->cache_dir = ‘saemc://smartytpl/’;
$smarty->compile_locking = false; // 防止调用touch,saemc会自动更新时间,不需要touch
上面三行是必须的。

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

0 0
原创粉丝点击