3 回答
TA貢獻1811條經驗 獲得超6個贊
.post()application/jsondata$_POST
application/json
$postdata = file_get_contents("php://input");$request = json_decode($postdata);$email = $request->email;$pass = $request->password;$_POST[email protected]&password=somepasswordjQuery.serialize()encodeURIComponent()
TA貢獻1946條經驗 獲得超3個贊
if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST))
$_POST = json_decode(file_get_contents('php://input'), true);TA貢獻1824條經驗 獲得超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));}添加回答
舉報
