迅睿开源框架是一款PHP8高性能·简单易用的PHP开源开发框架, 基于MIT开源许可协议发布,不限制商业使用,以多端互联为设计理念, 支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
业务经理
微信扫描以上二维码
028-61286886
在线咨询
有没有正则的大神,想去掉img标签中的style里所有的属性要怎么写呀?
/style="[^"]*?"/g
style=\"(.*?)\"
style=(['"])(.*?)(['"])
{preg_replace("/style=\"(.*?)\"/U", '', $content)}
<?php $str='<img src="images/logo.png" style="width:100px;height:10px" alt="">'; echo preg_replace('/style=\".*?\"/',' ',$str); ?>
单双同时自动匹配的代码如下
{preg_replace("/style=\"(.*?)\"/U", '', $content)}百度找了很多<?php $str='<img src="images/logo.png" style="width:100px;height:10px" alt="">'; echo preg_replace('/style=\".*?\"/',' ',$str); ?>