在公共的common.php
中
function subtext($text, $length)
{
if(mb_strlen($text, ‘utf8’) > $length)
return mb_substr($text,0,$length,’utf8′).’ …’;
return $text;
}
在模版中调用则:
{$tops.title | subtext=18}
在公共的common.php
中
function subtext($text, $length)
{
if(mb_strlen($text, ‘utf8’) > $length)
return mb_substr($text,0,$length,’utf8′).’ …’;
return $text;
}
在模版中调用则:
{$tops.title | subtext=18}
本文标题:TP5的字符串截取超过字符...显示
本文链接:https://www.haomeiwen.com/subject/qvlqbftx.html
网友评论