小编Ada*_*tra的帖子

调用 Laravel 中未定义的方法 stdClass::count()

我试图对我的 JSON 响应进行分页,但出现这样的错误

调用未定义的方法 stdClass::count()

我使用 guzzle 来自 Laravel API 的 JSON 响应......

这是我的控制器代码

public function index()
{
    $response =  $this->client->get('getUserIndex')->getBody();
    $content = json_decode($response->getContents());
    $total = $content->count();
    $paginationRecord = CollectionPaginate::paginate($content, $total, '15');
    return view('configuration.comuserprofiles.ComUserProfilesList', ['paginationRecord' => $paginationRecord->data]);
}
Run Code Online (Sandbox Code Playgroud)

php pagination json laravel

0
推荐指数
1
解决办法
2423
查看次数

标签 统计

json ×1

laravel ×1

pagination ×1

php ×1