1.如何使用这个方法去更新数据,这个方法是使用
php artisan make:controller ArticlesController
生成的
public function update(Request $request, $id)
{
//
}
在路由中应该如何定义这个方法的访问方式
2.web表单中如何提交delete、put请求,删除只是访问一个链接
/**
* 资源控制器RESTFUL
* GET /articles ArticlesController@index
* GET /articles/create ArticlesController@create
* POST /articles ArticlesController@store
* GET /articles/{id} ArticlesController@show
* GET /articles/{id}/edit ArticlesController@edit
* PUT/PATCH /articles/{id} ArticlesController@update
* DELETE /articles/{id} ArticlesController@destory
*/
表单中如何实现最后的DELTE请求,a发送ajax可以做到使用http的各种请求方式,表单或页面中如何实现
表单中需要加上隐藏列<input type="hidden" name="_method" value="PUT(PATCH、DELETE)">
ps:https://laravel-china.org/top...
ps:https://laravel.com/docs/5.0/...
第一里的删除,是需要DELETE传输方式,要是使用get的话 需要在head里制定传输方式delete,不然没法区别
至于get和delete的区别,你需要去看http的协议!
最下面有个列表!