리자

[펌] preg_replace 로 게시물 스타일 태그 제거

· 2010-10-05 (화) 14:29:54 · 1720 · 1
preg_replace 로 게시물 스타일시트를 제거 하려고 합니다.
아래와 같이 처리 하면 잘 처리 되어는데요.
$content = preg_replace("!<style(.*?)<\/style>!is", '', $content);
아래의 스타일 처럼 들어가면 적용이 안되네요
답변 부탁 합니다.


== 문제의 스타일 ======================================
<STYLE> body {background-image:url(http://blogfiles7.naver.net/data17/2006/7/4/102/5_1147903815-coco767.gif); background-attachment: fixed; background-repeat: repeat; background-position: bottom right;} table { background-color: transparent
; } td { background-color: transparent; }<STYLE>
=====================================================<div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 18:00:23 Regular Expression (정규표현식)에서 이동 됨]</div>
|

댓글 1개

$content = preg_replace("/<style[^<]*</is", "", $content);

이런 코드가 아닐까요?
$content = preg_replace("/<style[^<]*</is", "", $content);

이런 코드가 아닐까요?
댓글을 작성하시려면 로그인이 필요합니다.

팁게시판

6,077건

디자인과 관련된 유용한 정보를 공유하세요. 질문은 상단의 QA에서 해주시기 바랍니다.

+
제목 글쓴이 날짜 조회
10-10-05 조회 981
10-10-05 조회 1,721
10-10-05 조회 3,010
10-10-05 조회 2,092
10-10-05 조회 2,013
10-10-05 조회 1,038
10-10-05 조회 1,063
10-10-04 조회 1,157
10-10-04 조회 929
10-10-04 조회 1,301
10-10-04 조회 1,587
10-10-03 조회 1,242
10-10-02 조회 1,081
10-10-02 조회 1,052
10-10-01 조회 1,102
10-10-01 조회 2,357
10-10-01 조회 992
10-10-01 조회 1,001
10-09-30 조회 1,020
10-09-30 조회 2,029
10-09-30 조회 1,676
10-09-30 조회 1,376
10-09-30 조회 1,065
10-09-30 조회 1,415
10-09-30 조회 1,709