- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是一组 Controller 的列表:
Route::group([
'prefix' => 'some-prefix',
], function () {
Route::get('/', 'MyController@index')->name('some-prefix');
Route::post('/get', 'MyController@getData')->name('some-prefix.get');
Route::get('/getall/{type}', 'MyController@getAllData')->name('some-prefix.getall');
Route::get('/create', 'MyController@create')->name('some-prefix.create');
Route::post('/', 'MyController@store')->name('some-prefix.store');
Route::get('/edit', 'MyController@edit')->name('some-prefix.edit');
Route::get('/{id}/edit/', 'MyController@edit')->name('some-prefix.edit');
Route::put('/{id}', 'MyController@update')->name('some-prefix.update');
Route::get('/cambiarestado/{id}', 'MyController@cambiarestado')->name('some-prefix.cambiarestado');
});
http://myapp.com/some-prefix/ANYTHING-that-doesnt-match
(1/1) MethodNotAllowedHttpException
in RouteCollection.php (line 251)
at RouteCollection->methodNotAllowed(array('PUT'))
in RouteCollection.php (line 238)
at RouteCollection->getRouteForMethods(object(Request), array('PUT'))
in RouteCollection.php (line 176)
failOrFind
在我的
store
里面和
edit
Controller 中的方法,因此我可以将其还原为 404 路由,例如:
http://myapp.com/some-prefix/9999/edit
9999
不存在,但我该怎么做我问的?
最佳答案
转至 App\Exception
打开handler.php
在 render()
方法添加:
public function render($request, Exception $exception)
{
if($exception instanceof \Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException){
return abort('404');
}
return parent::render($request, $exception);
}
关于php - MethodNotAllowedHttpException,重定向到 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46836778/
从其他站点的文档中尝试了许多代码示例和示例,但它们均无效,或者我不知道如何使用它。怎么解决这个错误呢?看起来不太好,可以尝试猜测路线的客户或用户都可以看到此错误。将其更改为404或自定义 Blade
我在设置的资源丰富的路由上不断收到 MethodNotAllowedHttpException 错误。当我运行 php artisan route:list 时,补丁/放置请求存在,我的表单引用 jo
我正在尝试删除一条记录Db 和我得到 methodnotallowed: 家庭 Controller public function index() { $YourData =
我正在尝试更新数据库中的字段,但我做不到 这是我的路线: Route::get('orders', [ 'uses' => 'OrderController@postOrder', '
这是一组 Controller 的列表: Route::group([ 'prefix' => 'some-prefix', ], function () {
我正在尝试运行一些非常基本的东西。我已经习惯了 CI,现在正在学习 Laravel 4,但他们的文档并没有让这一切变得容易!无论如何,我正在尝试创建一个登录表单,并通过在下一个表单中打印来确保数据已成
当我使用 ajax 提交表单数据时,出现错误 MethodNotAllowedHttpException。 HTML // Form $('#loginForm').su
我正在尝试通过写入 web.php 路由到 edit.blade.php 来更新行 "Route::get('/owner-information/edit/{id}', ['as' => 'owne
在我的网站上,用户可以创建帖子和点赞帖子。在此之前我有一个与类似系统相关的错误,我设法解决了这个问题。但是,由于这个错误,我无法弄清楚它是什么。当用户点击时,会出现以下错误: Symfony \ Co
在本地主机上使用 postman ,我能够在我的 API 上成功使用 POST。但是当部署到服务器并使用 postman 时,我总是得到错误 405:MethodNotAllowedHttpExcep
首先,在获取请求时,我会显示一个表单,在提交它时,它会转到一个 post url,在 Controller 中做一些工作,然后返回另一个具有表单的 View 。提交此表单后我验证了一些事情,如果验证失
我在实时服务器上遇到以下错误: request.ERROR: Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodN
表格: {{ Form::open(array('url' => 'user/create', 'files' => true)) }} 路线: Route::resource('user', 'Us
你好,这是我的第一个问题。 我正在使用 php laravel 框架,但出现此错误 RouteCollection.php 第 233 行中的 MethodNotAllowedHttpExceptio
我正在尝试更新用户,但是当我点击提交按钮时,Laravel 抛出以下错误: "RouteCollection->methodNotAllowed(array('GET', 'HEAD', 'POST'
总是在验证失败时,我得到一个 MethodNotAllowedHttpException 路由.php Route::post('download', 'UrlController@download'
我似乎无法在/cars/{id?}/modify 中发布数据 错误: in RouteCollection.php line 219 at RouteCollection->methodNotAllo
这个问题已经有答案了: Symfony2 MethodNotAllowedHttpException on live server (3 个回答) 已关闭 5 年前。 我使用“添加产品”功能为我的网站
我最近加入了 Laravel 框架,所以首先我尝试在 Laravel 中制作一个 CRUD 系统,以了解它们的基本原理和功能。 现在我在更新现有记录时遇到错误 MethodNotAllowedHttp
路由.php Route::post('deactivatecountry', array( 'as' => 'deactivatecountry',
我是一名优秀的程序员,十分优秀!