Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以这是有效的:
DB::select()->from('images')->execute()->as_array();
但我不喜欢我的视图中的数组(2 个额外的字母)我想使用该对象。我怎样才能做到这一点?
DB::select()->from('images')->as_object()->execute();
这是一个错误。
除了我对原始问题的评论之外,任何执行的查询都将返回一个Database_Result可以被 foreach 的对象,并且应该为每一行返回 stdClass 对象。
Database_Result
您可以使用:
DB::select()->from('images')->as_object()->execute()->as_array();