ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
#### Laravel 支持直接返回数组或者模型(或者集合),以下两种方式最终会被自动转为 json 响应: ~~~ // 直接返回数组 Route::get('/request-json-array', function(){ $array = array('foo', 'bar'); //this route should returns json response return $array; }); // 或者返回模型/集合 Route::get('/request-json-model', function(){ //if 'User' is an eloquent model, this route should returns json response return User::all(); }); ~~~