Remove the brackets in json?

后端 未结 2 1790
执笔经年
执笔经年 2021-02-14 07:40

How can I get rid of the brackets below for json processing?

[{\"success\":true,\"filename\":\"bialding_and_rebialding_plymouth02.jpg\"},{\"success\":true,\"file         


        
相关标签:
2条回答
  • 2021-02-14 08:07

    str_replace(array('[', ']'), '', htmlspecialchars(json_encode($result), ENT_NOQUOTES)); ?

    0 讨论(0)
  • 2021-02-14 08:14

    You can pull out the json and return just that by doing the following inside your function:

    return $message[0];  //  only json
    

    or you can return it all and remove it afterwards:

    $uploader = new uploader();
    $result1 = $uploader->handle_upload('uploads/');
    $result2 = $result[0];
    
    0 讨论(0)
提交回复
热议问题