sina SAE上使用smarty

sina SAE上使用smarty

作者:LAMP小白  点击:2909  发布日期:2012-09-20 00:35:00  返回列表

SAE不支持本地文件写入,Smarty不能直接使用,但可以通过wrapper使用。
以smarty3为例:
include_once("Smarty3.0.6/Smarty.class.php"); //包含smarty类文件
$path="saemc://templates_c";//使用MC Wrapper
mkdir($path);
$smarty = new Smarty();
$smarty->template_dir = "./templates";
$smarty->compile_dir = $path; //设置编译目录
$smarty->assign("str1", "Hello,Smarty.");
//编译并显示位于./templates下的index.tpl模板
@$smarty->display("sample.tpl");
//直接使用smarty会报chmod错误,这个错误不会影响到smarty的使用 请加@忽略

上一篇:PHP正则匹配中文 下一篇:快递查询API
0