2

私は次のような変数を持っています

$content = "Lorem Ipsum is simply <b>dummy text of the printing</b> and typesetting industry.
 Lorem Ipsum has been the industry's <i>standard dummy text</i> ever since the 1500s 
<string>javascriptFunc();</script>" ;

str_replace('a', '', $content);すべての「a」を使用すると、削除されます。ただし、<script>タグ内の「a」は削除しないでください。

または、この方法以外のテキストを置き換える方法はありますか

助けてください 。

4

2 に答える 2

2

HTML DOM パーサーを使用してタグ内のテキストを取得し、結果に対して str_replace() 関数を実行します。

于 2010-06-11T06:12:14.657 に答える
0

http://php.net/manual/en/function.strip-tags.php

これはあなたを助けるでしょう..

于 2010-06-11T06:11:41.683 に答える