天天看點

TP5的字元串截取超過字元...顯示

在公共的

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}