求php 如何用正则去除style样式
展开阅读全文
/(style="[^"]+")/ 或者
/(style=".*")/

第一个他会保留其他数据

$html = preg_replace('/(style="[^"]+")/', "", $html);

第二个用法的话,他只会保留第一个数据。

建议用第二个会比较好