테스트 사이트 - 개발 중인 베타 버전입니다

최신글 제목에 특수문자 없애기 채택완료

돼지코구뇽 8년 전 조회 2,513

</strong><span style="font-size: 14.6667px;"><?php echo cut_str(strip_tags($list[$i]['subject']), 34,'…'); ?></span><strong style="color: rgb(127, 127, 127); font-family: Arial, 돋움, Dotum; font-size: 12px;">
  


cut_str로 제목글자 자르기함수를 써놨는데 여기에 추가적으로 특수문자들은 안나오게 처리하려고합니다


!!!!!!!!!!!!!!!!!!!!!!

댓글을 작성하려면 로그인이 필요합니다.

답변 3개

채택된 답변
+20 포인트

댓글을 작성하려면 로그인이 필요합니다.

</strong><span style="font-size: 14.6667px;"><?php </span></p><p style="font-size: 14.6667px;"><span style="white-space: pre;">				</span>$business_title = $list[$i]['subject']; </p><p style="font-size: 14.6667px;"><span style="white-space: pre;">				</span>$business_title = str_replace(array("!","@","#","$","※"), "", $business_title); ?></p><p><span style="font-size: 14.6667px; white-space: pre;">				</span><span style="font-size: 14.6667px;"><?php echo cut_str(strip_tags($business_title), 34,'…'); ?></span><strong style="color: rgb(127, 127, 127); font-family: Arial, 돋움, Dotum; font-size: 12px;">


이렇게 처리하니 잘되네요 대신 array 노가다를 좀..

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

8년 전

</p><p>function processText($text) {
    $text = strip_tags($text);
    $text = trim($text);
    $text = htmlspecialchars($text);
    return $text;
}

윗분 답변과 더불어 이걸 쓰시면 좋겠네요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인