[英]Laravel taking url string as parameter
So basically i want to create a route like http://example.com/{page_slug}
on my laravel app, but when i register that in my routes file it affects pages like http://example.com/login
as it give me an error related to page "login" not found. 因此,基本上我想在laravel应用上创建一个类似http://example.com/{page_slug}
的路由,但是当我在我的路由文件中注册它时,它会影响http://example.com/login
页面,因为我找不到与页面“登录”相关的错误。
Here is my route with the page slug parameter 这是我的页面塞子参数路线
Route::get('/{slug}','Admin\PageController@viewPage');
The login route id generated automatically, i'm using laravel 5.4 自动生成的登录路由ID,我使用的是laravel 5.4
Any help is appreciated 任何帮助表示赞赏
I found the solution: 我找到了解决方案:
All i had to do was put the 我所要做的就是把
Route::get('/{slug}','Admin\PageController@viewPage');
As the last route, so other routes would be checked first. 作为最后一条路线,因此将首先检查其他路线。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.