$user = Db::table('user')->where(['id' => 1])->first(); 查询结果集$user是对象,如何转成数组,直接加->toArray();报错
$user ? $user->toArray() : [];
$user = (array)Db::table('user')->where(['id' => 1])->first();