리자

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

· 2010-10-05 (화) 14:29:54 · 3055 · 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);

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

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
MySQL 10-11-13 조회 4,087
기타 10-11-09 조회 3,530
Flash 10-11-04 조회 2,243
기타 10-10-29 조회 2,997
JavaScript 10-10-29 조회 3,764
MySQL 10-10-27 조회 3,034
jQuery 10-10-24 조회 5,312
기타 10-10-23 조회 3,172
기타 10-10-22 조회 3,335
Flash 10-10-21 조회 2,506
MySQL 10-10-21 조회 3,243
Linux 10-10-19 조회 2,335
기타 10-10-19 조회 2,206
Flash 10-10-19 조회 3,673
기타 10-10-19 조회 2만
JavaScript 10-10-19 조회 2,346
기타 10-10-19 조회 2,407
기타 10-10-18 조회 3,746
기타 10-10-15 조회 1,817
기타 10-10-14 조회 3,284
Flash 10-10-12 조회 2,723
Flash 10-10-07 조회 2,383
JavaScript 10-10-07 조회 2,739
기타 10-10-06 조회 6,389
기타 10-10-05 조회 2,031
기타 10-10-05 조회 3,056
JavaScript 10-10-05 조회 9,105
정규표현식 10-10-05 조회 4,075
Flash 10-09-30 조회 4,524
기타 10-09-26 조회 3,607