2011-11-14 1 views
0

아래 코드가 있다고 가정하면 <p></p>의 HTML 태그 만 어떻게 제거 할 수 있습니까?PHP로 특정 HTML 태그 자르기

감사

<p>This is the first line<br /> This is the second line with image <img src="1.jpg" /></p> 

답변

1

귀하의 str_replace 기능을 찾고. 혼합않는 str_replace

(혼합 $ 검색, 혼합 $이 혼합 $ 대상이 [& 은 $를 계산 int로] 교체) 감사합니다,

<?php 

    $str = '<p>This is the first line<br /> This is the second line with image <img src="1.jpg" /></p>' 
    echo str_replace(array('<p>', '</p>'), NULL, $str); 

?> 
+0

의미가 있습니다. –

+0

@CharlesYeung, 좋습니다. upvote로 자유롭게 내 대답 옆의 체크 표시를 누르십시오. –