Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
彼のアクションが弦をある点から別の点へと切断することであるというスクリプトを作成したいと思います。
例えば:
<div id="box" style="font-size:bold;height:30px;width:100px;border: 1px solid black">xx</div>
スクリプトがすべてのスタイルをカットすることを望みます。それは次のようになります。
<div id="box">xx </div>
どうすればできますか?
スタイル属性を置き換えるだけの場合は、次のようにします。
$str = '<div id="box" style="font-size:bold;height:30px;width:100px;border: 1px solid black">xx</div>'; $str = preg_replace('/ style=\"[^\"]*\"/', '', $str);