我正在尝试在react-native中使用FETCH发布帖子请求。我收到验证错误。我在这里缺少什么?
if(!isset($errMSG))
{
$stmt = $user_home->runQuery("INSERT INTO cam_info (userID,
cam_name,
cam_model,
pixels,
photoshoot,
cam_rent,
cam_img,
mobile,
state,
address,
upd_date,
code )
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ");
$stmt->bindParam(1,$id);
$stmt->bindParam(2,$cam_name);
$stmt->bindParam(3,$modelname);
$stmt->bindParam(4,$pixel);
$stmt->bindParam(5,$photoshoot);
$stmt->bindParam(6,$rentpday);
$stmt->bindParam(7,$userpic);
$stmt->bindParam(8,$usermob);
$stmt->bindParam(9,$state);
$stmt->bindParam(10,$useraddrs);
$stmt->bindParam(11,$upd_date);
$stmt->bindParam(12,$ucode);
if($stmt->execute())
{
$successMSG = "Record saved success";
}
else
{
$errMSG = "error while inserting....";
}
谢谢。
答案 0 :(得分:1)
getAccessToken() {
let formData = new FormData();
formData.append('grant_type', 'client_credentials')
formData.append('client_id', 'yourID')
formData.append('client_secret', 'yourSecret')
let headers = new Headers();
return fetch('https://yourBaseUrl/oauth2/token/', {
method: 'POST',
headers: headers,
body: formData,
})
.then((response) => response.json())
}