Smarty truncated string PHPcode $ str ['name'] = & quot; truncated string length & quot; $ str ['name'] = & quot; string length & quot; & lt; {$ str. name | truncate_cn: & quot; 6 & quot;: & quot ;... & quot;} & gt; smarty truncated string
PHP code
$ Str ['name'] = "truncation string length" $ str ['name'] = "getting string length" <{$ str. name | truncate_cn: "6 ":"... "}> In this case, if the number is less than 6 digits, it also includes... how can I determine whether the character of $ str ['name'] is greater than 6 to add... ah?
------ Solution --------------------
If (count ($ t_string [0])> $ length) // if the length exceeds the specified length
Return join ('', array_slice ($ t_string [0], 0, $ length). $ etc; // Intercept and add...
Return join ('', array_slice ($ t_string [0], 0, $ length). $ etc; // This sentence is incorrect.
It should be
Return $ string; // returns the result as is.