0
所以在我的routes.php文件的文件我有这样的:为什么我在Laravel的路线返回404错误?
Route::get('contact', function() {
return view('contact');
});
当我去domain.com/contact我得到一个返回的错误。但是当我把:
Route::get('/', function() {
return view('contact');
});
并转到domain.com页面出现。任何想法可能会造成这种情况?
完全routes文件:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function() {
return view('homeIndex');
});
Route::get('contact', function() {
return view('contact');
});
PHP工匠路线:列表回报:
+--------+----------+---------+------+---------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+---------+------+---------+------------+
| | GET|HEAD |/ | | Closure | web |
| | GET|HEAD | contact | | Closure | web |
+--------+----------+---------+------+---------+------------+
你能分享你的routes.php更多的代码吗?也许所有的路线呢?这可能是因为在路线上有前缀的路线组,您有错误 –
这是我尝试上班的第一条路线,但是我将它张贴了,因为我拥有它。 – Nash
尝试在前面的联系路线添加一个“/”...路线::获得('/联系',功能....' –