这是我的目标。在bun
数组中,我有2个对象。我只需要访问"oid": 1
和"bid": 1
对象详细信息。无需访问第二个对象。
{
"oid": "1",
"oname": "Fon",
"bun": [{
"bid": "1",
"bname": "Ets",
"dep": [{
"did": "1",
"dname": "Dptment",
"pids": [{
"pid": "1",
"st": "active"
}, {
"pid": "2",
"st": "active"
}]
}]
}, {
"bid": "2",
"bname": "US",
"description": "unit2",
"dep": []
}]
}
怎么可能?
答案 0 :(得分:3)
实现的一种方法是使用过滤器。
$user = DB::connection('mysql')->select('select * from usersdata');
foreach ($user as $record) {
$user = DB::connection('mysql1')->table("tablename")->insert(get_object_vars($record));