21,886
社区成员
发帖
与我相关
我的任务
分享
$arr=array();
for($i=0;$i<=1;$i++)
{
$content="http://www.xxx.com/product_info.php?products_id=$i";
preg_match_all('/http:\/\/www.xxx.com\/product_info.php\?products_id=\d+/',$content,$link_array[]);
}
function check_is_array($arr)
{
foreach ($arr as $key=>$value)
{
//如果是数组继续递归
if(is_array($value))
{
check_is_array($value);
}
else
{
//echo $new_value.=$value;//这样能输出
return $new_value.=$value;//这样返回NULL,为什么啊?
}
}
}
var_dump(check_is_array($link_array));
for($i=0;$i<5;$i++){
$content="http://www.xxx.com/product_info.php?products_id=$i";
preg_match_all('/http:\/\/www.xxx.com\/product_info.php\?products_id=\d+/',$content,$link_array[]);
}
var_dump(check_is_array($link_array));
function check_is_array($arr){
if(is_array($arr)){
$value="";
foreach($arr as $arri)
$value.=check_is_array($arri);
return $value;
}else
return $arr;
}