[Problem] Overview pass JSON client data to the server, the server parses the data json_decode return null.
[Received by the data server]
[{\ "GKey \": \ "1538140267eqwno \", \ "imgAdd \": \ "Bi Ying Road, Haizhu District, Guangzhou Rural Commercial Bank 4 (Exhibition Xincheng Branch) \", \ "imgTime \": \ "2018 -09-28 21: 11: 19 \ ", \" img \ ": \" file: ///storage/emulated/0/Yuehong/1538140279tewau.jpg \ "}, {\" gKey \ ": \" 1538140267eqwno \ ", \" imgAdd \ ": \" Bi Ying Road, Haizhu District, Guangzhou Rural Commercial Bank 4 (Exhibition Xincheng Branch) \ ", \" imgTime \ ": \" 2018-09-28 21: 11: 30 \ " , \ "img \": \ "file: ///storage/emulated/0/Yuehong/1538140290fwloc.jpg \"}]
[Online] analyze the reasons a lot of people say that coding problems (presence of Chinese received data), but here is the "\" backslash problem.
[Solution] stripslashes process.
$imgList=stripslashes($imgList);
$arr=json_decode($imgList,true);
foreach output successfully:
Name: 1538140279tewau.jpg, Address: 4 Bi Ying Road, Haizhu District, Guangzhou Rural Commercial Bank (Exhibition Xincheng Branch), array length: 2
Name: 1538140290fwloc.jpg, Address: 4 Bi Ying Road, Haizhu District, Guangzhou Rural Commercial Bank (Exhibition Metro branch), the array length: 2