PHP中此代码的等价物是什么:
curl -X PUT \
-H "X-Parse-Application-Id: 4zcn5cCjKV8zYqoaHcasKFyUBxPB2qP7NYOZhMnw" \
-H "X-Parse-REST-API-Key: GHHLNoICIZFXkD59QAwbDRVUd4JeSU4hVpBFq2md" \
-H "Content-Type: application/json" \
-d '{"score":73453}' \
https://api.parse.com/1/classes/GameScore/Ed1nuqPvcm
修改
$url = 'https://api.parse.com/1/classes/' . $table_name . '/Jwqe23ls';
$headers = array( "Content-Type: application/json",
"X-Parse-Application-Id: " . $appId,
"X-Parse-REST-API-Key: " . $restKey,
"X-HTTP-Method-Override: PUT" );
$objectData = '{"number":"4"}';
$rest = curl_init();
curl_setopt($rest,CURLOPT_URL,$url);
curl_setopt($rest,CURLOPT_POSTFIELDS, $objectData);
curl_setopt($rest,CURLOPT_HTTPHEADER,$headers);
curl_setopt($rest,CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($rest);
echo $response;
curl_close($rest);
现在它有效......
答案 0 :(得分:0)
如果你想要PUT
,请按照以下步骤操作:
curl_setopt($ch, CURLOPT_PUT, true);
此外,在我看来,score:73453
与number:4
不同,但在此阶段可能并不重要。