|
 |
15년 전 |
/*
문자열 자르기
결과=cut(문자열,길이);
*/
function cut($str,$max)
{
$count = strlen($str);
if($count >= $max)
{
for ($pos=$max;$pos>0 && ord($str[$pos-1])>=127;$pos--);
if (($max-$pos)%2 == 0)
$str = substr($str, 0, $max) . "...";
else
$str = substr($str, 0, $max+1) . "...";
return $str;
}
else
{
$str = "$str";
return $str;
}
}
|
|
추천 : 886 |
추천
목록
|
|