您的位置:首页 > 产品设计 > UI/UE

正则匹配Ueditor中得到的文本中的自己上传的图片链接

2013-05-06 10:11 281 查看
<?php
$text="<p>good<img src=\"http://img.baidu.com/hi/tsj/t_0037.gif\" /></p><p><img src=\"http://uppic.b0.upaiyun.com/2013/5/5/1367741844238814.png_440\" style=\"float:none;\" /></p><p><img src=\"http://uppic.b0.upaiyun.com/2013/5/5/1367741858405222.png_440\" style=\"float:none;\" /></p><p>test</p><p><img src=\"http://img.baidu.com/hi/tsj/t_0036.gif\" /></p><p>good</p><p><br /></p>";
$text=stripslashes($text);
//正则
$preg = "|<img src=\"(http:\/\/uppic.b0.upaiyun.com.+?)\".*?>|";
preg_match_all($preg,$text,$res);
print_r($res[1]);die;// 结果是:Array ( [0] => http://uppic.b0.upaiyun.com/2013/5/5/1367741844238814.png_440 [1] => http://uppic.b0.upaiyun.com/2013/5/5/1367741858405222.png_440 )
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: