$table="<P>户型南北通透,视野光线好,总价超低,周边配套齐全,购物方便,出行也比较方便,未来升值空间大。
</P><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716248936506.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716198283399.JPG'/>";现需:得到src=后面的值,并用| 连起来 ,应该得到 http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG|http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG|http://0791.8ff.cn/upload/broker/user/432/pic/201101141716198283399.JPG
这如何实现,在线等
然后echo implode("|",$matched);
我只需src=''中的值,应该得到三个图片的url,
<?php
$str="<P>户型南北通透,视野光线好,总价超低,周边配套齐全,购物方便,出行也比较方便,未来升值空间大。
</P><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716248936506.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716198283399.JPG'/>";preg_match_all("/src='(.*?)'/",$str,$matched);echo implode("<br>",$matched['1']);
$str="<P>户型南北通透,视野光线好,总价超低,周边配套齐全,购物方便,出行也比较方便,未来升值空间大。
</P><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716248936506.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716198283399.JPG'/>";preg_match_all("/src='(.*?)'/",$str,$matched);echo implode("|",$matched['1']);
$table="<P>户型南北通透,视野光线好,总价超低,周边配套齐全,购物方便,出行也比较方便,未来升值空间大。
</P><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716248936506.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716198283399.JPG'/>";$result=array();
preg_match_all('/http.*?JPG/',$table,$result);
echo implode('|',$result[0]);
</P><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716298364890.JPG'/><br><br><img width='500' height='336'src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716248936506.JPG'/><br><br><img width='500' height='336' src='http://0791.8ff.cn/upload/broker/user/432/pic/201101141716198283399.JPG'/>";$arr=array();preg_match_all("/src='(.*?)'/",$str,$arr);
print_r($arr[1]);
{ $content = stripslashes($table);
preg_match_all("/<img.+src=(('|\")(.+)('|\"))/Uis",$content,$out);
foreach($out[1] as $t)
{
$t = str_replace("'","",$t);
$t = str_replace("'","",$t);
$tables.=$t.'|';
}
$tables_arr=explode("|",$tables);
$str=' \r';
foreach($tables_arr as $value)
{
if($value!='' && $value!=NULL )
{
$str.=" \r \r " ;
}
}
return $str;
}