我正在尝试将文件对象数组转换为数组数组,但我总是得到空结果。我尝试了下面的代码,但它给了我空数组$json = json_encode($this->request->getUploadedFiles());$array = json_decode($json, true);var_dump($array);exit;以上 var_dump 的结果:array(2) { [0]=> array(0) { } [1]=> array(0) { } }来自 POST 请求的文件对象数组:array(2) { [0]=> object(Phalcon\Http\Request\File)#695 (8) { ["_name":protected]=> string(52) "27657439_10157161194752222_6818734335050869731_n.jpg" ["_tmp":protected]=> string(24) "D:\xampp\tmp\php145A.tmp" ["_size":protected]=> int(31591) ["_type":protected]=> string(10) "image/jpeg" ["_realType":protected]=> NULL ["_error":protected]=> int(0) ["_key":protected]=> string(9) "path_8" ["_extension":protected]=> string(3) "jpg" } [1]=> object(Phalcon\Http\Request\File)#700 (8) { ["_name":protected]=> string(8) "asif.PNG" ["_tmp":protected]=> string(24) "D:\xampp\tmp\php145B.tmp" ["_size":protected]=> int(425449) ["_type":protected]=> string(9) "image/png" ["_realType":protected]=> NULL ["_error":protected]=> int(0) ["_key":protected]=> string(9) "path_14" ["_extension":protected]=> string(3) "PNG" } }我需要像下面这样的结果数组:array(2) { ["path_8"]=> array(2) { [0]=> array(5) { ["error"]=> int(0) ["name"]=> string(14) "image-name.jpg" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(14) "/tmp/phpqImhgm" ["size"]=> int(222301) } [1]=> array(5) { ["error"]=> int(0) ["name"]=> string(42) "WhatsApp Image 2018-02-20 at 18.48.13.jpeg" ["type"]=> string(10) "image/jpeg" ["tmp_name"]=> string(14) "/tmp/php6HAWpJ" ["size"]=> int(84153) } }
1 回答
- 1 回答
- 0 关注
- 200 浏览
添加回答
举报
0/150
提交
取消