zoukankan      html  css  js  c++  java
  • laravel 框架给数组分页

            //Get current page form url e.g. &page=6
            $currentPage = LengthAwarePaginator::resolveCurrentPage();

            $currentPage -= 1;

            //Create a new Laravel collection from the array data
            $collection = new Collection($log_data['content']);

            //Define how many items we want to be visible in each page
            $perPage = 10;

            //Slice the collection to get the items to display in current page
            $currentPageSearchResults = $collection->slice($currentPage * $perPage, $perPage)->all();

            //Create our paginator and pass it to the view
            $paginatedSearchResults= new LengthAwarePaginator($currentPageSearchResults, count($collection), $perPage);

            $url = url('admin/statistics/index');

            $paginatedSearchResults = $paginatedSearchResults->setPath($url);

  • 相关阅读:
    joins and includes
    学习库
    HTML5 画图--文字
    http://qiye.qianzhan.com/ 企业查询宝
    js 获取input选择的图片的信息
    input:file属性
    CSS 箭头
    颜色
    CSS 点击图片替换样式
    图片转base64
  • 原文地址:https://www.cnblogs.com/handongyu/p/7535067.html
Copyright © 2011-2022 走看看