尝试删除 restserver 代码点火器中的项目时出错.我有这个错误:任何想法


Error trying to delete item in restserver codeigniter. I have this error: any idea?

我收到错误:

无法打开流: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

内存缓存删除