2013-04-06 141 views
0

我尝试使PUT请求,但我不能。我的表格。Codeigniter PUT请求

<form method="put" action="http://localhost/index.php/book"> 
    <input type="text" name="bookName" /> 
    <input type="submit" value="Send"/> 
</form> 

我控制器

<?php 

    require(APPPATH.'libraries/REST_Controller.php'); 

    class Book extends REST_Controller { 

     function index_put(){ 
      echo $this->put('bookName'); 
     } 

    } 

?> 

的问题是,不显示任何东西。

回答

0

的HTML标准does not supportput<form method="">属性里面,如果你把任何东西比postget其他应当作为GET要求,按照规范发送。

许多framewrok为此实现的规范解决方法是在表单中包含一个隐藏的_method字段,并将实际的HTTP动词放在那里。您好像正在使用this library,并且它也是这样做的_method parameter解决方法。