[英]Weird White Screen on Laravel Routes (“/”)
From the title itself, I have a weird Laravel bug. 从标题本身来看,我有一个奇怪的Laravel错误。 I have test page for my home page which has a route name of "main".
我的首页有测试页,其路由名称为“ main”。 It works perfectly fine.
它工作得很好。 However, when I tried to change it from route::get("main") to route::get("/") I end up with a white page.
但是,当我尝试将其从route :: get(“ main”)更改为route :: get(“ /”)时,我得到了一张白页。 No errors, when I view source, no code or whatsoever.
在查看源代码,代码或任何内容时都没有错误。 I am running Laravel 5.6
我正在运行Laravel 5.6
// Landing Page actual Route
// White Page
Route::get('/', function () {
return view('templates.landing-blank');
});
// Landing Page
// Works Perfectly.
Route::get('main', function() {
return view('templates.landing-blank');
});
Is this something related to htaccess? 这和htaccess有关吗? I already doubled checked everything and copied the htaccess but still no avail.
我已经仔细检查了所有内容并复制了htaccess,但仍然无济于事。 I also did a composer update and the problems still persist.
我也做了作曲家更新,问题仍然存在。
The first parameter of the Route::get
should be the the url path to access the page, so "main" would be accessed by example.com/main
and "/" would be just example.com
. 在第一个参数
Route::get
应该访问的页面的URL路径,所以“主”会被访问example.com/main
和“/”将只是example.com
。 Could that be the problem? 这可能是问题吗?
Can you go to .env and change the label APP_DEBUG to " true "? 您可以转到.env并将标签APP_DEBUG更改为“ true ”吗? Maybe you can see the error.
也许您可以看到错误。
And I think you need to add a "/" to the "main" route. 而且我认为您需要在“主要”路线上添加“ /”。 Like that:
像那样:
Route::get('/main', function() {
return view('templates.landing-blank');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.