0
以下のコードがあるとしますが、<p>
と</p>
のHTMLタグのみを削除するにはどうすればよいですか?特定のHTMLタグをPHPでトリムします
おかげ
<p>This is the first line<br /> This is the second line with image <img src="1.jpg" /></p>
以下のコードがあるとしますが、<p>
と</p>
のHTMLタグのみを削除するにはどうすればよいですか?特定のHTMLタグをPHPでトリムします
おかげ
<p>This is the first line<br /> This is the second line with image <img src="1.jpg" /></p>
あなた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);
?>
それは動作します、ありがとうございました。 –
@CharlesYeung、いいよ。 upvoteを自由にして、私の答えの横にあるチェックマークを押してください。 –