search

Home  >  Q&A  >  body text

JSON to PHP code? Ask God for enlightenment~

JSON is as follows:

{
    "pageList":{
        "pageCount":1,
        "curPage":1,
        "rowsCount":1,
        "colList":[
            {
                "colEnName":"id"
            },
            {
                "showName":"true",
                "colZhName":"供应商名称",
                "widgetType":"textWidget",
                "colEnName":"gysmc"
            },
            {
                "colZhName":"备注",
                "widgetType":"textAreaWidget",
                "colEnName":"bz"
            },
            {
                "colZhName":"金额",
                "widgetType":"moneyWidget",
                "colEnName":"money"
            },
            {
                "colZhName":"总人数",
                "widgetType":"numberWidget",
                "colEnName":"number"
            },
            {
                "colZhName":"入住日期",
                "dateFormat":"yyyy-MM-dd",
                "widgetType":"dateWidget",
                "colEnName":"rzrq"
            },
            {
                "colZhName":"入住具体时间",
                "dateFormat":"yyyy-MM-dd HH:mm",
                "widgetType":"dateWidget",
                "colEnName":"rzjtsj"
            },
            {
                "colZhName":"入住年月",
                "dateFormat":"yyyy-MM",
                "widgetType":"dateWidget",
                "colEnName":"rzny"
            }
        ],
        "dataList":[
            {
                "number":"2100000",
                "rzrq":"2017-11-17",
                "gysmc":"供应商名称",
                "money":"549771.0",
                "rzny":"2017-11",
                "bz":"备注信息10",
                "rzjtsj":"2017-11-17 08:00",
                "id":"10"
            }
        ]
    },
    "error":null,
    "errorCode":0,
    "success":true
}


Could you please tell me if you want to use PHP to output this JSON. How to write it?

BIN(๑•̀ㅂ•́)و✧BIN(๑•̀ㅂ•́)و✧645 days ago607

reply all(4)I'll reply

  • 靠近你深拥你

    靠近你深拥你2023-03-10 20:51:42

    try this echo json_encode($result,JSON_UNESCAPED_UNICODE);

    reply
    0
  • 入道人

    入道人2023-03-10 13:24:31

    This section is json data. We need to read this json file response.pageList.colList through axios and then output it on the console. PHP will use php syntax to output js and js syntax will be output.

    reply
    0
  • 大瓶可乐@php.cn

    大瓶可乐@php.cn2023-03-02 15:37:29

    What does output mean? Is it taking out the data in json?

    Yes you can json_decode

    reply
    0
  • BIN(๑•̀ㅂ•́)و✧

    I use ChatGPT OK

    BIN(๑•̀ㅂ•́)و✧ · 2023-03-02 15:39:47
  • Cancelreply