Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/240.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在Laravel中创建到“/”(斜线)的路线?_Php_Html_Laravel_Laravel Blade - Fatal编程技术网

Php 如何在Laravel中创建到“/”(斜线)的路线?

Php 如何在Laravel中创建到“/”(斜线)的路线?,php,html,laravel,laravel-blade,Php,Html,Laravel,Laravel Blade,我想制作一个导航栏,在其中可以导航到welcome.blade.php页面 header.blade.php: <a class="navbar-brand" href="{{route('pages/welcome')}}">Main Page</a> 我得到这个错误: Route [pages/welcome] not defined. 有人知道这里的解决方法吗?路线: 路由::获取“/”,函数{ 返回“页面/欢迎”视图;

我想制作一个导航栏,在其中可以导航到welcome.blade.php页面

header.blade.php:

<a class="navbar-brand" href="{{route('pages/welcome')}}">Main Page</a>
我得到这个错误:

Route [pages/welcome] not defined. 
有人知道这里的解决方法吗?

路线:

路由::获取“/”,函数{ 返回“页面/欢迎”视图; }->命名为“欢迎页面”; 链接:

如果要将地址设置为页面/欢迎的形式,应设置url方法,而不是如下所示的路由:

这里的route'pages/welcome'这段代码期望web.php中定义的路由名为'pages/welcome'

哪一个是

路由::获取“/”,函数{ 返回“页面/欢迎”视图; }->名称为“页面/欢迎”; 同样地 如果您{{route'test'}},那么route::get'/',..->name'test'


ref link

查看Laravel关于路由的文档。你缺少一些基本知识。没有名为pages/welcome的路由。欢迎刀片是否位于名为pages的文件夹中??
Route [pages/welcome] not defined.