但确实如此?访问/欢迎/开始时发生,我已经仔细检查过该文件确实存在。
路线:
<?php
Route::group(['domain' => 'localhost', 'namespace' => 'Frontend'], function () {
Route::group(['middleware' => 'guest', 'namespace' => 'Guest'], function() {
Route::group(['prefix' => 'welcome'], function() {
Route::any('/begin', ['as' => 'frontend.welcome_begin', 'uses' => 'WelcomeController@begin']);
Route::any('/language', ['as' => 'frontend.welcome_language', 'uses' => 'WelcomeController@language']);
Route::any('/final', ['as' => 'frontend.welcome_final', 'uses' => 'WelcomeController@final']);
});
Route::any('/', ['as' => 'login', 'uses' => 'LandingController@redirect']);
Route::get('/login', ['as' => 'frontend.login', 'uses' => 'LoginController@getView']);
Route::post('/login', ['as' => 'frontend.login', 'uses' => 'LoginController@onPost']);
});
Route::group(['middleware' => 'auth', 'namespace' => 'User'], function() {
Route::get('/home', ['as' => 'frontend.home', 'uses' => 'HomeController@getView']);
});
});
WelcomeController:
<?php
namespace App\Http\Controllers\Frontend\Guest;
use App\Http\Controllers\Controller;
use Redirect;
use Illuminate\Http\Request;
class WelcomeController extends Controller
{
public function begin()
{
return route('frontend.welcome.begin');
}
}
查看配置:
<?php
return [
'paths' => [
resource_path('views'),
],
'compiled' => realpath(storage_path('framework/views')),
];
&#34;路线发生错误(&#34; frontend.welcome.begin&#34;)&#34;线
答案 0 :(得分:2)
路线不存在。您的路线名为frontend.welcome_begin
,但您正在呼叫frontend.welcome.begin
您的代码必须是:return route('frontend.welcome_begin');
我建议,简要查看代码,将欢迎路由更改为frontend.welcome.{name}
而不是使用下划线,因为它将遵循您已定义的其余路由名称< / p>
答案 1 :(得分:0)
首先检查路线名称是否正确
php artisan route:list