Array([1]=>stdClass Object ([a]=>1[b]=>1[c]=>123))如何用PHP foreach 遍历这种带对象的二维数组
我用foreach($parameas$key=>$val){$a=$key;$b=$val['a'];$c=$val['b'];$d=$val['c'];}遍历报错PH...
我用
foreach ($parame as $key => $val){
$a = $key;
$b= $val['a'];
$c= $val['b'];
$d= $val['c'];
}
遍历报错PHP Parse error: syntax error, unexpected 'Object' (T_STRING), expecting ')' in D:\www\myweb\dfjklog.php on line 20 展开
foreach ($parame as $key => $val){
$a = $key;
$b= $val['a'];
$c= $val['b'];
$d= $val['c'];
}
遍历报错PHP Parse error: syntax error, unexpected 'Object' (T_STRING), expecting ')' in D:\www\myweb\dfjklog.php on line 20 展开
展开全部
stdClass Object(。。。。)这是一个对象,你可以这样
foreach ($parame as $key => $val){
$b=$val->a;
$c=$val->b;
$d=$val->c;
}
foreach ($parame as $key => $val){
$b=$val->a;
$c=$val->b;
$d=$val->c;
}
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询