【问题标题】:laravel 5.1 Route::post not working randomlylaravel 5.1 Route::post 不能随机工作
【发布时间】:2015-09-10 07:17:07
【问题描述】:

当我昨天下班时,路由工作得很好。从那以后我就再也没有碰过它,在我测试了网站(并且它有效)之后,我唯一做的就是使用php artisan make:model 制作一个新模型并进行迁移。

大约 35 分钟前,当我进来上班时,噗。网站不工作。路线使用 get 方法(Route::get('/', 'blahContoller@index') 但在所有Route::post 方法上都失败了。我很难过。在这个项目之后回到 laravel 5,5.1 令人难以置信地坏了,而且比 5.0 更糟,并且让我没有尽头实际浪费更多时间的问题,然后 laravel 应该节省。

我得到的错误:

RouteCollection.php 第 143 行中的 NotFoundHttpException

我的路线:

Route::get('/', 'TurboController@index');

Route::post('checkout', 'TurboController@checkout');
Route::post('securePayment', 'TurboController@securePayment');

Route::get('thankYou', function(){
    return view('thankYou');
});

我不明白,我从昨天上午 9:00 开始就没有碰过路由文件,一直工作到今天测试它。

在你问之前我已经尝试过 DUMPAUTOLOAD ;)

【问题讨论】:

  • 首先,这个问题应该被标记,因为它没有问题。其次,您在哪个 url 上收到错误以及在请求此页面时使用了哪种请求方法。
  • 你也检查过this question and accepted answer吗?
  • 任何使用 Route::post 的路由都不起作用,所以 localhost:8000/checkoutlocalhost:8000/securePayment。我在表单中使用了 post 方法。
  • 您能否给出您正在使用的 laravel 的确切版本php artisan -V 以及使用默认端口 80 时路由是否有效?
  • 我正在使用 laravel 5.1.2 - 不,默认端口上的结果相同

标签: php laravel routes laravel-5.1


【解决方案1】:

尝试在终端中运行这些

php artisan clear-compiled, php artisan cache:clear, php artisan route:clear

【讨论】:

  • 即使我有这个问题当我提交一个带有 method=patch 的表单或发布它时,我也会遇到同样的错误
猜你喜欢
  • 1970-01-01
  • 2016-01-09
  • 1970-01-01
  • 1970-01-01
  • 2021-08-13
  • 1970-01-01
  • 2016-04-03
  • 2016-05-02
  • 1970-01-01
相关资源
最近更新 更多