手机版

PHP Smarty模板的简单用法

时间:2021-11-05 来源:互联网 编辑:宝哥软件园 浏览:

本文描述了PHP Smarty模板的简单使用。分享给大家参考,如下:

Index.php:

要求('./libs/smarty . class . PHP ');$smarty=新Smarty;//添加自定义修饰符$ smarty-register插件('修饰符',' e ',' html specialchars ');$smarty-registerPlugin('修饰符',' trim ',' trim ');//$ smarty-force _ compile=true;$ smarty-debug=true;$ smarty-cache=true;$ smarty-cache _ lifetime=120;//定义标识符$ smarty-left _ delimiter=' { ';$ smarty-right _ delimiter=“}”;//绑定变量$ smarty-assign ('test _ html ',' ahaha/a ');$ smarty-display(' index . TPL ');index.tpl:

H1 {$ test _ HTML | e}/h1Postscript:如何让VS支持带tpl扩展的HTML编辑。

在菜单【工具选项】中设置,如下图:所示。

更多对PHP感兴趣的读者,请查看本网站专题:《PHP网络编程技巧总结》、《PHP基本语法入门教程》、《php操作office文档技巧总结(包括word,excel,access,ppt)》、《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》、《php常见数据库操作技巧汇总》、0103010。

希望本文对PHP编程有所帮助。

版权声明:PHP Smarty模板的简单用法是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。