줄바꿈 문자열 제거가 안되요

줄바꿈 문자열 제거가 안되요

QA

줄바꿈 문자열 제거가 안되요

답변 1

본문

글내용과 제목등을 공백제거후 board_new_table 에 넣을려고 합니다. (필드하나추가함)

에디터 사용하구요

 

해서 검색시 키워드는 무조건 공백제거하고 board_new_table 하나만 검색하면 

쿼리 부하는 줄이고 (실제 얼마나 효과 있는지 모르지만요)

최신글만 조회하려구요 

검색결과 정열도 테이블 관계 없이 글 포스팅 순으로...

 

문제는 줄바꿈이 그대로 살아 있네요...


$new_content = $row['ca_name'];

$new_content .= $row['wr_name'];

$new_content .= $row['wr_subject'];

$new_content .= strip_tags($row['wr_content']);

 

//이제부터 공백제거 줄바꿈제거

$new_content = str_replace("&nbsp","",$new_content);

$new_content = str_replace(" ","",$new_content);

$new_content = str_replace('\r\n', '', $new_content);

$new_content = preg_replace('/\r\n|\r|\n/','',$new_content);

$new_content = preg_replace('/ /', '', $new_content);

$new_content = preg_replace("/\s+/", "", $new_content);

$new_content = preg_replace('/[[:punct:]]/u', '', $new_content); // 특수문자

 

이렇게 했는데도 DB에 보면 줄바꿈이 살아 있는 경우는 왜 그런가요??

 

 

 

 

 

 


이 질문에 댓글 쓰기 :

답변 1

get_text 

또은

stip_tags를 이용하시면 처리 되실 듯 합니다. 

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 55
© SIRSOFT
현재 페이지 제일 처음으로