码迷,mamicode.com
首页 > 其他好文 > 详细

字符串超过特定长度使用...代替

时间:2018-07-16 11:17:36      阅读:109      评论:0      收藏:0      [点我收藏+]

标签:超过   nbsp   bsp   int   color   function   字符   使用   substr   

function intercept($str,$length = 10){
    if (strlen($str)>$length)
        $str=substr($str,0,$length) . ‘...‘;
    return $str;
}

 

字符串超过特定长度使用...代替

标签:超过   nbsp   bsp   int   color   function   字符   使用   substr   

原文地址:https://www.cnblogs.com/pcx105/p/9316046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!