Laravel分页器链接功能:isset中的偏移量类型为非法或为空

问题描述

我正在创建一个“长度感知分页器”,并将其传递给Laravel 8,如下所示:

$post_collection = collect($posts);
$pagination = new LengthAwarePaginator($post_collection->slice(($currentPage - 1) * $perPage,$perPage),$post_collection->count(),$perPage,$currentPage,['path' => env('APP_URL','')]);
$pagination->setPageName('pg');

就实际分页而言,此方法非常有效。但是,当我尝试在视图中调用{{ $pagination->links() }}时,出现以下错误Illegal offset type in isset or empty (View: /my-path/vendor/laravel/framework/src/Illuminate/Pagination/resources/views/tailwind.blade.PHP)
对应于顺风视图此部分的第一行(文件中的74):

<a href="{{ $url }}" class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 hover:text-gray-500 focus:z-10 focus:outline-none focus:bor
    {{ $page }}
</a>

我真的不确定这里出了什么问题,有人知道如何解决吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)