大家好,来为大家解答以上问题。smarty模板还在使用吗,smarty模板很多人还不知道,现在让我们一起来看看吧!
1、 从官方网站下载http://www.smarty.net/download的最新版本
2、 解压缩后,根据以下设置复制libs和configs目录
3、 模板/
4、 模板_c/
5、 缓存/
6、 配置/
7、 libs/
8、 注意:templates_c和cache目录的权限应该设置为777(chmod -R 777 templates_ccache)
9、 在templates目录中添加一个demo.tpl文件,并在其中写入hello world。
10、 Index.php文件如下:
11、 ?服务器端编程语言(Professional Hypertext Preprocessor的缩写)
12、 要求(‘。/libs/smarty . class . PHP ‘);
13、 $smarty=新Smarty;
14、 //$smarty-assign(‘result ‘,$ RES);
15、 $ smarty-display(‘ demo . TPL ‘);
16、 ?
17、 至此,基本的hello world程序已经编写完成。输入网址,打开网页,就可以看到了。
18、 Smarty使用变量替换的方法将php中的变量替换成。tpl模板文件。tpl模板文件中的变量和表达式使用{$data},这些变量在php中通过assign赋值进行替换。
本文到此结束,希望对大家有所帮助。
© 版权声明
本文来自早安心语(www.zaoanxinyu.com),未经允许请勿转载。
THE END



请登录后发表评论
注册
社交帐号登录