foreach循环不能正确使用json编码Php
我有多个数组(数组中的对象),但我从未运行过foreach循环,它可以工作 只有一次,有什么问题?我错在哪里foreach循环不能正确使用json编码Php,php,codeigniter,loops,foreach,Php,Codeigniter,Loops,Foreach,我有多个数组(数组中的对象),但我从未运行过foreach循环,它可以工作 只有一次,有什么问题?我错在哪里 Array ( [0] => stdClass Object ( [_id] => 5cc6896028497b75f44cbf31 } [1] => stdClass Object ( [_id] => 5cc6896028497b75f44cbf32
Array
(
[0] => stdClass Object
(
[_id] => 5cc6896028497b75f44cbf31
}
[1] => stdClass Object
(
[_id] => 5cc6896028497b75f44cbf32
}
...
}
这是我的代码,但循环只在一段时间内工作,但我有很多记录(超过100条)
您可以重写foreach循环:
<?php
$final = json_decode($response,true);
foreach($final as $key => $re)
{
echo $re['_id']. "<br>";
}
数组响应中的数据在哪里?$record
包含什么?为什么不迭代一下$final
?你能在这里分享你的$response
吗?你基本上是说数组表示法有效-但对象表示法无效-逻辑从何而来?
<?php
$final = json_decode($response,true);
foreach($final as $key => $re)
{
echo $re['_id']. "<br>";
}