Rumah > Artikel > pembangunan bahagian belakang > 求正则达人解决方法
求正则达人
IE浏览器下:
alt="" src="/upload/articles/20121204/images/201212040328205506018siw5.jpg" complete="complete" data-cke-saved-src="/upload/articles/20121204/images/201212040328205506018siw5.jpg"/>
FF浏览器下:
alt="" />
这个是用编辑器上传的图片,现在我需要把图片里面的style全部删除掉,后面的内容保持原样。求高手帮我写个正则!!
------解决方案--------------------
<br /> $str='<img style="max-width:90%" src="/upload/articles/20121204/images/201212040328205506018siw5.jpg" complete="complete" data-cke-saved-src="/upload/articles/20121204/images/201212040328205506018siw5.jpg" alt="" />';<br /> $aa=preg_replace('/style=".*?"\s+/','',$str);<br /> echo $aa;<br />