我正在使用backbone和CodeIgniter Rest服务器, 来自主干网的帖子和获取请求正常工作 但put和delete请求者获得了404错误, “状态”:假的,“错误”:“未知的方法。”}带Backbone,DELETE和PUT请求的CodeIgniter Rest服务器返回404
编辑:我改变了源代码,看看哪种方法笨试图运行 我控制器网址是
http://local/host/impacto/index.php/interviews/
PUT请求的URL是
http://localhost/impacto/index.php/interviews/13
和CodeIgniter的运行功能13_put代替input_put
我控制器
class Interview extends REST_Controller {
function __construct(){
parent:: __construct();
}
public function index_get(){
echo "get";
}
public function index_post(){
echo "post";
}
public function index_put($id){
echo "update: " . $id;
}
public function index_delete($id){
echo "delete: " . $id;
}
}
可能重复[在PHP中处理PUT/DELETE参数](http://stackoverflow.com/questions/2081894/handling-put-delete-arguments-in-php) –
不一样的图书馆,我使用https://github.com/philsturgeon/codeigniter-restserver – Idob
我碰到了完全相同的问题;发送PUT到“Interview/{id}”调用方法“13_put ()“而不是”index_put(13)“...... –