21,887
社区成员
发帖
与我相关
我的任务
分享
$str = '<div style="width:1920px;">
<img width="1440" height="800" alt="文字介绍" src="/images/123.png" style="border:1px solid #f00;height:800px;" />
</div>';
echo preg_replace('#(<img.*?style=".*?)width:\d+px;([^"]*?.*?>)#i','$1$2',$str);
/*
<div style="width:1920px;">
<img width="1440" height="800" alt="文字介绍" src="/images/123.png" style="border:1px solid #f00;height:800px;" />
</div>
*/