在laravel中,查询数据库后,返回的对象,可以用下面的办法变为数组

$nodes = Db::table('system_node')->orderBy('sort', 'asc')->orderBy('id' ,'asc')->get()->map(function ($value) {
            return (array)$value;
        })->toArray();

 

相关文章:

  • 2022-12-23
  • 2021-11-13
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-30
猜你喜欢
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-02
  • 2022-12-23
相关资源
相似解决方案