我正在使用CodeIgniter Rest服务器,正在发出PUT请求。在chrome和firefox中一切正常,但是在Internet Explorer中,我不断收到错误消息,提示请求方法PUT未出现在Access-Control-Allow-Methods列表中。,我什至添加了响应标头以允许使用不同的方法,以下是其余服务
public function service_put()
{
if (!$this->_allow) return;
$data = $this->_put_args;
if(isset($data))
{
// have my arguments
try{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST,PUT,GET,DELETE');
header('Access-Control-Allow-Headers: Origin,X-Requested-With,Content-Type, Accept');
$this->response(['done' => TRUE], REST_Controller::HTTP_OK); // (200) HTTP response code
}
catch(Exception $e)
{
$this->response(array('error' => $e->getMessage()), $e->getCode());
}
return;
}
else
{
$this->returnBadRequest();
return;
}
}