0

一致した 2 つの文字列が必要で、一致した文字列の後に < p > タグを追加します。

$string1="<p>he adventures <p>
<p>of < span >adolescence< /span > had taught Piet < span >Barol< /span > that he</p>";


$matching_with_string="he adventures
of adolescence had
taught Piet Barol 
that he";

文字列 1 の出力が必要で、HTML タグのすべてのインクルードで同じままになります。

4

1 に答える 1

0

あなたはこのようなことを試すことができます

<?php
$strWithHTML="<p>he adventures <p>
<p>of < span >adolescence< /span > had taught Piet < span >Barol< /span > that he</p>";

$strWITHOUTHTML=str_replace(array('< ','/',' >','span'),'',strip_tags($string1));

編集 :

私はHTML形式で結果を出したい

<?php
$strWithHTML="<p>he adventures <p>
<p>of < span >adolescence< /span > had taught Piet < span >Barol< /span > that he</p>";

echo htmlentities($strWithHTML);
于 2013-11-06T07:54:06.163 に答える