我是一個新手,我堅持使用Codeigniter在curl中進行刪除。 這是我第一個問題,如果我錯過了任何東西,我很抱歉。 以下是我的代碼,只有編輯工作(所以我遺漏了代碼),但我的刪除捲曲不起作用,我有點卡住了。 在此先感謝。curign在codeigniter中刪除
問題是它並沒有刪除,我認爲我的捲曲是錯誤的。
public function function3($data, $hostURL) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $hostURL.'..............');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 90);
curl_exec($ch);
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if($http_code =! 200) {
throw new Exception(curl_error($ch), curl_errno($ch));
} else {
return "Deleted";
}
curl_close($ch);
}
請告訴我們只有您有問題的代碼。這意味着什麼「不起作用」,你會得到什麼錯誤?你爲什麼要向我們展示另一個刪除控制器/模型? – shaggy
我覺得我的curl for delete是錯誤的,因爲它不會刪除我想刪除的號碼。 – Andy