3 回答
TA贡献1811条经验 获得超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贡献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));}
添加回答
举报