PHP
문자열 자르는 함수 cut_str
yeon.Biju
2016. 12. 11. 20:17
/* 20140823 문자열 자르는 함수 추가 */
function cut_str($str, $len, $footer = "..."){
$c = ord($str{$len});
while ($c > 127 && $c < 192) $c = ord($str{--$len});
return substr($str,0,$len).(strlen($str)-strlen($footer) >= $len ? $footer : '');
}
워드프레스에서는 이게 잘 됨