- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前正在开发一个论坛系统 (laravel 5.3),我收到一个错误,可能是因为我的路由设置有问题。
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/
Route::get('/', 'IndexController@index')->name('index');
Auth::routes();
Route::get('/index', 'IndexController@index')->name('index');
Route::get('/thread/{id}', 'ThreadController@showThread')->name('thread_detail');
Route::get('/privacybeleid', 'PagesController@privacyPolicy');
Route::get('/over-ons', 'PagesController@about');
Route::group(['middleware' => 'auth'], function() {
Route::get('/thread/nieuw', 'ThreadController@showForm')->name('thread_form');
Route::post('/thread', 'ThreadController@create')->name('create_thread');
Route::post('/thread/{id}/reply', 'CommentController@create')->name('create_comment');
});
当我想查看一个线程 (website.com/thread/{id}) 时,我没有收到任何错误,一切正常。但是,当我想在某个主题 (website.com/thread/{id}/reply) 上添加新评论或创建一个新主题 (website.com/thread/nieuw) 时,出现以下错误:
MethodNotAllowedHttpException in RouteCollection.php line 218:
我尝试将 Route::get 更改为 Route::post(反之亦然),但随后出现另一个错误。
当我访问 website.com/thread/nieuw 时,我什么也看不到(页面不存在)。即使我有 session (已登录)。
对了:routes/web.php有提示吗?让我知道
注意:我是荷兰人,所以“nieuw”的意思是"new"
最佳答案
尝试放这条路线:
Route::post('/thread/{id}/reply', 'CommentController@create')->name('create_comment');
在此之前:
Route::get('/thread/{id}', 'ThreadController@showThread')->name('thread_detail');
关于php - RouteCollection.php 第 218 行中的 MethodNotAllowedHttpException 我该怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41141288/
从其他站点的文档中尝试了许多代码示例和示例,但它们均无效,或者我不知道如何使用它。怎么解决这个错误呢?看起来不太好,可以尝试猜测路线的客户或用户都可以看到此错误。将其更改为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',
我是一名优秀的程序员,十分优秀!