分页效果解析

来源:互联网 发布:怎么判断淘宝客链接 编辑:程序博客网 时间:2024/06/10 04:05
先来个加密解密:
Crypt::encrypt($request->secret)
Crypt::decrypt($encryptedValue);
Hash 单向加密/判断:
 Hash::make($request->newPassword)
Hash::check('plain-text', $hashedPassword)
辅助函数:
数组/路径/字符串/URL/其它
$array = array_add(['name' => 'Desk'], 'price', 100);
$array = array_collapse([1, 2, 3], [4, 5, 6], [7, 8, 9]);
list($keys, $values) = array_divide(['name' => 'Desk']);
$array = array_dot(['foo' => ['bar' => 'baz']);
$array = array_except($array, ['price']);
$array = ['name' => 'Desk', 'price' => 100];
$array = [100, 200, 300];

$value = array_first($array, function ($key, $value) {
    return $value >= 150;});
$value = array_first($array, $callback, $default);
$array = ['name' => 'Joe', 'languages' => ['PHP', 'Ruby'];

$array = array_flatten($array);
$array = ['products' => ['desk' => ['price' => 100]];

array_forget($array, 'products.desk');
$array = ['products' => ['desk' => ['price' => 100]];

$value = array_get($array, 'products.desk');
$array = ['products' => ['desk' => ['price' => 100]];

$hasDesk = array_has($array, ['products.desk']);
 
分页用法:
$users = DB::table('users')->paginate(15);
 
如果仅仅想显示上一页、下一页这样简单的分页的话,就选择。
$users = DB::table('users')->simplePaginate(15);
 
view 里面显示分页:
{!!$users->render()!!}
 
辅助情况:
$result->count();
$result->currentPage()
$result->hasMorePages()
$result->lastPage()
$result->nextPageUrl()
$result->perPage()
$result->previousPageUrl()
$result->total()
$result->url($page)
 
 以上是分页效果解析

Redis使用:


互联网+时代,时刻要保持学习,携手千锋PHP,Dream It Possible。

原创粉丝点击