做小程序或手机端经常会遇到商品详情,文章详情里带图片的从别的地方复制过来带着样式,导致超出屏幕显示不全的问题 php解决 functionformat_img($content,$style=''){ if(empty($style))$style='max-width:100%;height:auto;'; $content=preg_replace("/(\<img)(?!(.?style=['\"](.)['\"])[^\>]+\>)/i","$1style=\"\"$2",$content); returnpreg_replace("/(\<img.?styl...