how to html form post - file uploading and reading json response from php server

后端 未结 5 1577
名媛妹妹
名媛妹妹 2020-12-18 06:42

i am trying file uploading to php my server.file and data uploading through multi part /form-data ,the file and data received on php server but in my php server return json

5条回答
  •  独厮守ぢ
    2020-12-18 07:20

    try json_decode.

        $data = ({"code":0, "message":"success"});
        $array = json_decode($data, true);
    

    by passing 2nd parameter to true you will get response in array instead of object.

    the array will be then populated as follow:

        array (size=2)
        'code' => int 0
        'message' => string 'success' (length=7)
    

提交回复
热议问题