Php writes the registration interface, the front end uses the format of ajax, and the post request sends json,php how to get the parameters.

{

username: "11",
password: "222"

}

php:

$username = isset($_POST["username"]) ? $_POST["username"] : "";
$password = isset($_POST["password"]) ? $_POST["password"] : ""; 

is it impossible to get it?

Apr.01,2021

$raw = file_get_contents('php://input');
$json = json_decode($raw,true);

print_r($json);

take a look at the error message


press @ xialeistudio method


 json_decode($_POST,TRUE); 
json
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-1b3dfb1-2c3f0.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-1b3dfb1-2c3f0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?