in PHP, how to remove specific class from html tag?

后端 未结 4 910
忘了有多久
忘了有多久 2020-12-15 14:24

given the following string in PHP:

$html = \"

text 1

4条回答
  •  無奈伤痛
    2020-12-15 15:20

    $notest2 = preg_replace(
             "/class\s*=\s*'[^\']*test2[^\']*'/", 
             "class=''", 
             $src);
    

    C.

提交回复
热议问题