php-新的Laravel路线不起作用

我有一个问题,laravel中的新路由无法正常工作,URL显示正确的路由,但几乎好像没有到达我的路由Web文件,只是返回了每次都找不到的页面.

我努力了:
使用命名的路线,
将功能移至其他控制器,
清除路由缓存,
清除应用程序缓存,
自动转储负载
确保将AllowOverride设置为All,

Web.php:

    <?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

/*
|--------------------------------------------------------------------------
| Courses
|--------------------------------------------------------------------------
*/
Route::get('/courses', 'CourseController@index');
Route::get('/courses/create', 'CourseController@create');
Route::get('/courses/{course}', 'CourseController@show');
Route::get('/courses/{course}/edit', 'CourseController@edit');
Route::post('/courses', 'CourseController@store');
Route::patch('/courses/{course}', 'CourseController@update');
Route::delete('/courses/{course}', 'CourseController@destroy')->name('course-delete');

Route::get('/courses/statistics', 'CourseController@statistics');

/*
|--------------------------------------------------------------------------
| First Aid
|--------------------------------------------------------------------------
*/
Route::get('/section/{section}', 'SectionController@show');


/*
|--------------------------------------------------------------------------
| First Aid
|--------------------------------------------------------------------------
*/
Route::get('/progress', 'UserProgressController@index');
Route::get('/progress/create', 'UserProgressController@create');
Route::get('/progress/{section}', 'UserProgressController@show');
Route::get('/progress/formativeresults', 'UserProgressController@formativeresults');
//Route::get('/progress/coursestatistics', 'UserProgressController@coursestatistics');
//Route::get('/progress/{progress}/edit', 'UserProgressController@edit');
Route::post('/progress', 'UserProgressController@store');
//Route::patch('/progress/{progress}', 'UserProgressController@update');
//Route::delete('/progress/{progress}', 'UserProgressController@destroy')->name('progress-delete');

控制器:

public function statistics()
    {
        dd('Test');
       return view('coursestatistics');
    }

查看文件名:
coursestatistics.blade.php文件结构视图/ coursestatistics

链接到页面:

<a class="navbar-brand" href="/courses/statistics">
   {{ __('Statistics') }}
</a>

谁能告诉我是什么原因导致路由无法正常工作?

解决方法:

尝试放置

Route::get('/courses/statistics', 'CourseController@statistics');

在此特定路线代码的下方

Route::get('/courses/create', 'CourseController@create');

laravel路由的一般规则是将特定的路由放在相关的通配符路由之前.链接here

上一篇:PHP会话为空


下一篇:mac系统XAMPP安装phpredis扩展