使用Smarty模板的SAE的方法
Smarty是一个非常受欢迎的模板系统,将业务逻辑,是快速执行,并广泛应用于PHP网站。然而,有一个问题,当部署到新浪SAE(SAE),因为不能读写文件作为一个云计算平台,所以在smarty输出缓存文件无法实现。
错误信息:sae_fatal_error:捕获的exception'smartyexception'with message'unable写文件。 / / /网络templates_c wrt4e95555280ef1
SAE gives the solution to the use of Memcache.First, in application management, an initialization of Memcache is opened in service management.
然后修改Smarty的配置文件:
复制代码代码如下所示:
/ SAE编译文件存储在memcache
Smarty美元-> compile_dir = 'saemc: / / / smartytpl;
Smarty美元-> cache_dir = 'saemc: / / / smartytpl;
Smarty -> compile_locking =假美元; / /防止电话联系,saemc会自动更新,不需要触摸
以上三行是必要的。
所以,Smarty模板引擎可以运行在SAE。