function text_dot($text, $len){
$text = strip_tags($text);
if(strlen($text)<=$len) {
return $text;
} else {
$text = htmlspecialchars_decode($text);
$text = mb_strcut($text, 0, $len, 'utf-8');
$text = htmlspecialchars($text);
return $text."…";
}
}
위 함수를 사용하면 글자를 자른 후 말줄임표를 붙인다.
특징1 - htmlspecialchars_decode 함수
일단 htmlspecialchars_decode 함수를 사용했다.
HTML에서 <나 >를 표현하려면 <
… ▶전문 보기