How are json values converted into arrays? Or get the value inside.

1 because $_ POST in php cannot get the json value, use the file_get_contents ("php://input") method to get it.

After

2 is obtained, the value is obtained:

title=ww&imgFile=%2Fpublic%2Fupload%2Fimage%2F20180712%2F20180712024544_27715.jpg

3 I want to get the value in imgFile =% 2Fpublic%2Fupload%2Fimage%2F20180712%2F20180712024544_27715.jpg

in the value.

4 PHP version is 5.5

how do I get it?

Php
Mar.26,2021

use the explode method to process strings

explode ('& 'title=ww&imgFile=%2Fpublic%2Fupload%2Fimage%2F20180712%2F20180712024544_27715.jpg');


parse related functions, handling url parse_url (), processing? The following data parse_str ()

< hr >
$url        = 'https://img.codeshelper.com/upload/img/2021/03/26/qkpmguhkxq013427';
$urlArray   = parse_url($url);
print_r($urlArray);
parse_str($urlArray['query'], $paramList);
print_r($paramList);
exit;
< hr >

result

Array
(
    [scheme] => http
    [host] => www.abc.com
    [path] => /
    [query] => title=ww&imgFile=%2Fpublic%2Fupload%2Fimage%2F20180712%2F20180712024544_27715.jpg
)
Array
(
    [title] => ww
    [imgFile] => /public/upload/image/20180712/20180712024544_27715.jpg
)

here is a screenshot of the chrome console where you send the data. If your data is json, the format should not be like this. There is & so here should be the

from post.

if you submit json directly, you can convert it to an array using json_decode ('data',true).

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e50d29-4c7ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e50d29-4c7ec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?