Laravel 的 collection 某些字段会强制转类型?
$collection->each(function($grandPa){
$grandPa->level = 1;
$grandPa->id = 'advertiser_';
var_dump($grandPa->id);exit;
$fathers = $grandPa->children;
$fathers->each(function($father){
$father->level = 2;
$children = $father->children;
$children->each(function($child){
$child->level = 3;
});
});
});
var_dump($grandPa->id);exit;
这一行代码始终显示 int(0)
我多试了几次 是因为被强制转换成int了
laravel 有这样的机制吗? 怎么让它不强制转换?
我用另一个collection 同样执行一遍 就没出这个问题 哪位高手知道怎么回事
推荐文章: