php下img标签正则怎么琯 用preg_replace 代替吧。ereg_replace 自5.3 起就废弃了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $content = '<img width="563" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'12\'})" inpost="1" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" zoomfile="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" src="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" aid="48110" id="aimg_48110" initialized="true"><div disautofocus="true" class="tip tip_4 aimg_tip" initialized="true"></div>';$value = "data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg";$find=str_replace('/','\/',preg_quote($value));$fileurl = "/uploads/image/20140902/20140902105805_83325.jpg";echo preg_replace('/<img([\w\W]+?)zoomfile="'.$find.'"\s*src=".+?"([^>]+?)>/i', "<img$1 src='".$fileurl."'$2/>", $content);/*<img width="563" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})" inpost="1" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" src="/uploads/image/20140902/20140902105805_83325.jpg" aid="48110" id="aimg_48110" initialized="true"><div disautofocus="true" class="tip tip_4 aimg_tip" initialized="true"></div>*/ 探讨下缩略图算法的实现(70行实现和3行实现) mysql锁表的问题 急!新手虚心请教——php图像合成问题! 为什么我的PHP 浏览器直接显示HTML代码 网站子模块上传后影响原先的界面显示 莫名其妙的问题 Mysql中有没有类似str_replace的函数? 如何实现定时提醒 求助 页面执行时间怎么计算? 一条记录进入了,如何发一个email通知? 网站一直处于加载状态,重启路由器问题即可解决 PHP怎么实现复选框勾为1不勾为0呢
$content = '<img width="563" onmouseover="showMenu({\'ctrlid\':this.id,\'pos\':\'12\'})" inpost="1" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" zoomfile="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" src="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" aid="48110" id="aimg_48110" initialized="true">
<div disautofocus="true" class="tip tip_4 aimg_tip" initialized="true"></div>';$value = "data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg";
$find=str_replace('/','\/',preg_quote($value));
$fileurl = "/uploads/image/20140902/20140902105805_83325.jpg";
echo preg_replace('/<img([\w\W]+?)zoomfile="'.$find.'"\s*src=".+?"([^>]+?)>/i', "<img$1 src='".$fileurl."'$2/>", $content);/*
<img width="563" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})" inpost="1" onclick="zoom(this, this.src, 0, 0, 0)" class="zoom" file="data/attachment/forum/201405/21/134519pngfbniwifd61tky.jpg" src="/uploads/image/20140902/20140902105805_83325.jpg" aid="48110" id="aimg_48110" initialized="true">
<div disautofocus="true" class="tip tip_4 aimg_tip" initialized="true"></div>
*/