yt-summer 发表于 2017-4-4 09:25:44

smarty中可以使用php 函数来做modifier

smarty中可以使用php 函数来做modifier
例如:
{if $news|@count == 0}
后面的count就是php函数
一样可以传递参数给modifier
例如:
$myStr|substr:0:3 这个等于substr($mystr,0,3)
还可以继续用管道{$myStr|substr:0:3|strtoupper}
modifiers应用从左到右
页: [1]
查看完整版本: smarty中可以使用php 函数来做modifier