3 回答

TA貢獻(xiàn)1811條經(jīng)驗 獲得超6個贊
.post()
application/json
data
$_POST
application/json
$postdata = file_get_contents("php://input");$request = json_decode($postdata);$email = $request->email;$pass = $request->password;
$_POST
email=someemail@email.com&password=somepassword
jQuery.serialize()
encodeURIComponent()

TA貢獻(xiàn)1946條經(jīng)驗 獲得超3個贊
if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST)) $_POST = json_decode(file_get_contents('php://input'), true);

TA貢獻(xiàn)1824條經(jīng)驗 獲得超5個贊
if(isset($_SERVER["CONTENT_TYPE"]) && strpos($_SERVER["CONTENT_TYPE"], "application/json") !== false) { $_POST = array_merge($_POST, (array) json_decode(trim(file_get_contents('php://input')), true));}
添加回答
舉報