php 循环
<?php$str=file_get_contents("内容");preg_match('/xsong_name:"(.*)\',/iU',$str,$youku2);...
<?php
$str = file_get_contents ("内容");
preg_match('/xsong_name:"(.*)\',/iU', $str, $youku2);
$youku2[1]=str_replace("xsinger_id:0,xsinger_name:\"","",$youku2[1]);
$youku2[1]=str_replace("xsong_url:'","",$youku2[1]);
$youku2[1]=str_replace("\"","",$youku2[1]);
$r1 = explode(',', $youku2[1]);
echo $r1[0];
echo $r1[1];
echo $r1[2];
?>
怎么循环
由于网址被过滤,发不上来。要抓取的内容如下
_time:0,xsong_name:"白天不懂夜的黑",xsinger_id:0,xsinger_name:"王崇",xsong_url:'231522343.mp3',
_time:0,xsong_name:"白天不懂夜的黑1",xsinger_id:0,xsinger_name:"王崇1",xsong_url:'231522343.mp3',
以此类推 展开
$str = file_get_contents ("内容");
preg_match('/xsong_name:"(.*)\',/iU', $str, $youku2);
$youku2[1]=str_replace("xsinger_id:0,xsinger_name:\"","",$youku2[1]);
$youku2[1]=str_replace("xsong_url:'","",$youku2[1]);
$youku2[1]=str_replace("\"","",$youku2[1]);
$r1 = explode(',', $youku2[1]);
echo $r1[0];
echo $r1[1];
echo $r1[2];
?>
怎么循环
由于网址被过滤,发不上来。要抓取的内容如下
_time:0,xsong_name:"白天不懂夜的黑",xsinger_id:0,xsinger_name:"王崇",xsong_url:'231522343.mp3',
_time:0,xsong_name:"白天不懂夜的黑1",xsinger_id:0,xsinger_name:"王崇1",xsong_url:'231522343.mp3',
以此类推 展开
2个回答
展开全部
你抓取的是什么网页,网址是多少
追问
由于网址被过滤,发不上来。要抓取的内容如下
_time:0,xsong_name:"白天不懂夜的黑",xsinger_id:0,xsinger_name:"王崇",xsong_url:'231522343.mp3',
_time:0,xsong_name:"白天不懂夜的黑1",xsinger_id:0,xsinger_name:"王崇1",xsong_url:'231522343.mp3',
追答
foreach($r1 as $k){
echo $k;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询