tp框架,smarty 截取字符串【truncate和substr】,写法
truncate:
{$str|truncate}
{$str|truncate:30}
{$str|truncate:30:""}
{$str|truncate:30:"---"}
{$str|truncate:30:"":true}
{$str|truncate:30:"...":true}
substr:
{$str|substr=1}
{$str|substr=0,2}
{$str|substr=0,-2}
{$str|substr=-4}
{ $str|msubstr=0,5,'utf-8'}
网友评论