dtuzjzs3853 2018-06-27 01:35
浏览 48

使用php分享这个json数据

i am sending this to the API and receiving this in return

URL/list?limit=10&page=1

{
    "code": 1,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 30,
                "first_name": "jack",
                "last_name": null,

            },
            {
                "id": 31,
                "first_name": "Bean",
                "last_name": null,

            },
            {
                "id": 32,
                "first_name": "Stock",
                "last_name": null,

            },
            {
                "id": 33,
                "first_name": "Tangled",
                "last_name": null,


            },
            {
                "id": 34,
                "first_name": "Anna",
                "last_name": null,

            },
            {
                "id": 104,
                "first_name": "Tom",
                "last_name": "M",

            }
        ],
        "from": 1,
        "last_page": 2,
        "last_page": 2,
        "next_page_url": "URL/list?page=2",
        "path": "URL/list",
        "per_page": "10",
        "prev_page_url": "NULL",
        "to": 10,
        "total": 19
    },
    "msg": "Success"
}

now what i want to do is do a simple pagination but i do not know how to go about it using this particular data can some one please help me out what i think should be used is a bit of PHP jquery(AJAX) and html but i can no seem to get it i am very new to this and if some one could help me out it would be great

Please note i have no control over what the JSON Data thus i can not change it

  • 写回答

1条回答 默认 最新

  • dongluan1901 2018-06-27 02:11
    关注

    Cannot post as a comment due to low reputation but I do want to say this.

    StackOverflow isn't a place where you can just pawn off your dirty work on others here. You have to at least give your best shot and tell us where you're stuck with in order for people to help you.

    Here's a few resources on learning Pagination with PHP as well as several other answers on this site that help others with Pagination.

    http://www.phpfreaks.com/tutorial/basic-pagination

    Simple PHP Pagination script

    http://codingcyber.org/simple-pagination-script-php-mysql-5882/

    Most of these scripts you find will include MySQL, but for your array you would use array_split() in your case. Unless the data you're providing is also from MySQL then these will work great for you.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序