API JSON数组的分页

时间:2019-06-25 21:32:38

标签: php arrays pagination

我正在尝试为下面的数组创建一个分页页面。我正在使用API​​代码来获取该数组结果

ngAfterViewInit() {
fromEvent(this.input.nativeElement, 'keyup')
.pipe(
  startWith({}),
  switchMap(() => {
    return this.playerService
    .findPlayers(1, 'userName', this.input.nativeElement.value, 'asc', 0, 20)
    .map(data => {
      return data.players;
    });
})).subscribe(players => this.players = players);
}

我已经尝试过了

$arr = [
    'status' => 1,
    'msg' => [
            'total_records' => 3,
            'total_pages' => 3,
            'page_number' => 1,
            'per_page' => 1,
            'return_count' => 3,
            'page_result' => [

                    0 => array
                        (
                            'items' => 200052001,
                            'code' => 501,
                            'category' => 'watch',
                            'price' => 50,
                            'stock' => 1,
                        ),

                    1 => array
                        (
                            'items' => 200052001,
                            'code' => 401,
                            'category' => 'shirt',
                            'price' =>3,
                            'stock' => 1,
                        ),

                    2 => array
                        (
                            'items' => 200052001,
                            'code' => 172758801,
                            'category' => 'watch',
                            'price' => 200,
                            'stock' => 1,
                        ),

                ],

        ],

    'errcode' => 0,
];

但是问题是单击分页按钮后分页的按钮消失了,您能否全部显示使用API​​数组的最简单的分页方法?

0 个答案:

没有答案