扫码关注官方订阅号
我自己写的php框架,使用SMARTY作为模板引擎,还用封装php标签吗?
走同样的路,发现不同的人生
smarty 3中可以使用任何php的函数
{$data|json_encode} {json_encode($data)} {$data->toString()}
对于if,foreach之类的,smarty自身就有
{if $a == 1} ... {else} ... {/if} {foreach $data as $item} ... {foreachelse} ... {/foreach}
如果要自定义modifier,或者函数,标签等,还麻烦查看手册,以及参考文件夹:
smarty/libs/plugins/
比如,可以自定义函数:{template_include file=""}
{template_include file=""}
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
smarty 3中可以使用任何php的函数
对于if,foreach之类的,smarty自身就有
如果要自定义modifier,或者函数,标签等,还麻烦查看手册,以及参考文件夹:
比如,可以自定义函数:
{template_include file=""}