jinfakeji168/array-search

数组搜索,数组分页

1.0.4 2024-06-27 08:32 UTC

This package is auto-updated.

Last update: 2024-09-27 09:06:56 UTC


README

.

安装

$ composer require liaosp/array-search -vvv

使用

示例:

$target = [
    [
        'id'=>1,
        'status'=>3
        ],
    [
        'id'=>2,
        'status'=>1
    ],
    [
        'id'=>3,
        'status'=>2
    ],
    [
        'id'=>4,
        'status'=>1
    ],
    [
        'id'=>5,
        'status'=>1
    ],
    [
        'id'=>6,
        'status'=>1
    ],

];
$obj = new ArraySearch();

$data = $obj->arrayData($target)->paginate(1);//firstPageData  ,第一页数据。

where:

$data = $obj->arrayData($target)->where(['status'=>1])->paginate(1);//firstPageData  ,第一页数据。

whereIn

$data = $obj->arrayData($target)->whereIn(['status'=>[1,2]])->paginate(1);//firstPageData  ,第一页数据。

orWhere

$data = $obj->arrayData($target)->orWhere(['status'=>1,'id'=>1])->paginate(1);//firstPageData  ,第一页数据。

notWhere

$data = $obj->arrayData($target)->notWhere(['status'=>1,'id'=>1])->paginate(1);//firstPageData  ,第一页数据。

贡献

您可以通过以下三种方式之一进行贡献

  1. 使用 问题跟踪器 提交错误报告。
  2. 问题跟踪器 上回答问题或修复错误。
  3. 贡献新功能或更新wiki。

代码贡献流程并不非常正式。您只需确保遵循PSR-0、PSR-1和PSR-2编码规范。任何新的代码贡献都必须附有适用的单元测试。

许可证

MIT