해당 태그 및 태그의 내용을 모두 제거한다.
#style 태그 제거
$strContents = preg_replace('@<style(.*?)[[:space:]](.*?)</style>@i', '', $strContents);
#script 태그 제거
$strContents = preg_replace('@<script(.*?)[[:space:]](.*?)</script>@i', '', $strContents);
# p태그 추출
preg_match_all('@<p>(.*?)[[:space:]](.*?)</p>@i',$strContents,$arrContents, PREG_PATTERN_ORDER);
# 추출 후 합치기
$strContents = implode(" ",$arrContents[0]);
'Development > PHP' 카테고리의 다른 글
[CentOS 7] PHP 7.4 설치하기 (0) | 2022.02.23 |
---|---|
json decode 안될 때 (0) | 2022.01.12 |
preg_match_all (0) | 2022.01.11 |
Out of memory 메모리 부족 (0) | 2022.01.06 |
유니코드 변환(decode) (0) | 2022.01.05 |