我收到错误:
无法打开流:HTTP 包装器不支持可写连接
删除方法:
public function borrar_item_delete()
{
$id = (int) $this->delete('id');
// Validate the id.
if ($id <= 0)
{
// Set the response and exit
$this->response(NULL, REST_Controller::HTTP_BAD_REQUEST); // BAD_REQUEST (400) being the HTTP response code
}
$this->db->delete('pedido_fila', array('id' => $id));
$message = [
'id' => $id,
'message' => 'Deleted the resource'
];
$this->set_response($message, REST_Controller::HTTP_NO_CONTENT); // NO_CONTENT (204) being the HTTP response code
}
Ajax 请求:
var id_order = 1;
$.ajax({
url: 'http://www.api.verdulero.com/index.php/api/Pedidos/borrar_item?id='+id_order,
type: 'DELETE',
success: function(){
alert(id_order);
$(this).closest('tr').remove();
}
});
您无法使用 HTTP 删除,您必须使用本地文件系统来删除文件。
这可能会有所帮助:
Http write
内存缓存删除