Laravel NotFoundHttpException [英] Laravel NotFoundHttpException

查看:116
本文介绍了Laravel NotFoundHttpException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对这条路线有疑问.

I have a problem with this one route.

Route::get('va/{$uniqueid}','AdminController@VaShow')->name('va');

并在控制器中:

  public function VaShow($uniqueid = '123'){
      dd($uniqueid);
    }

但是当我尝试访问路由时,我仍然收到NotFoundHttpException. (它具有管理员前缀,但无论如何我都尝试使用url和视图直接访问它,但仍然相同) 鉴于:

but i still get NotFoundHttpException when trying to visit route. (it have admin prefix but anyway i'm trying to access it directly with url and in view but still same) in view:

{{route('va',['uniqueid'=>$v->uniqueid])}}

然后我在route:list中签入,那里:

and I checked in route:list, its there:

|        | GET|HEAD | admin/va/{$uniqueid}     | va                 | App\Http\Controllers\AdminControl
ler@VaShow               | web,admin    |

不知道我做错了什么

推荐答案

您路线中的美元符号使它失去了作用.路线中的变量不需要美元符号:

The dollar sign in your route is throwing it off. The variables in the route do not need a dollar sign:

Route::get('va/{uniqueid}','AdminController@VaShow')->name('va');

这篇关于Laravel NotFoundHttpException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆