列出路由时出现laravel-artisan错误



我对laravel有点陌生,遇到了一些我不知道如何解决的问题,甚至不知道从哪里开始寻找。有人能解释一下吗?

当我运行php artisan route:list

我得到:

[SymfonyComponentDebugExceptionFatalErrorException]
syntax error, unexpected ','

我只对routes.php做了几次更改。此后我对这些更改进行了注释并清除了缓存,但无论如何,这仍然会显示出来。

更新-路由的内容.php

<?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.
|
*/
/**
* Blade adjustments to make it work with Angular.js
*/
Blade::setContentTags('<%', '%>'); // for variables and all things Blade
Blade::setEscapedContentTags('<%%', '%%>'); // for escaped data
/**
* Send requests to Angular.js (may need rethinking eventually because this is
* essentially a whitelist)
*/
Route::get('/{page?}', function($name = 'dash') {
return View::make('index');
})->where('page', '(dash|todo|help|settings)');
// Commented out to make Angular.js pages work
//Route::get('/', 'DashboardController@index');
//Route::get('home', 'HomeController@index');
/**
* Page View Routes
* Author: Anthony Sinclair
* Date: 31/03/2015
*/
/** User GET for new Users created via the UI */
Route::get('user/new', 'UserController@create');
/** User POST for catching Users created via the UI */
Route::post('user/new', 'UserController@store');
/**
* RESTful API routes
* Author: Anthony Sinclair
* Date: 30/03/2015
*/
Route::group(array('prefix' => 'api/v1', 'before'=>'auth'), function(){
/** User based API call routing */
Route::resource('user', 'UserController');
/** People based API call routing */
Route::resource('recipient', 'PeopleController');
/** Survey based API call routing */
Route::resource('survey', 'SurveyController');
/** Survey Response based API call routing */
Route::resource('response', 'SurveyResponseController');
Route::resource('response/token/{survey_token}', 'SurveyResponseController@getResponsesForSurvey');
/** Survey Instigator - The sending of Surveys */
Route::resource('send/{survey_id}', 'SurveyInstigatorController@sendSurvey');
});
/** Nps based API call routing */
Route::get('/api/v1/nps/{survey_id}', 'NpsController@getNpsScore');
Route::get('/api/v1/nps/{survey_id}/{filter}', 'NpsController@getNpsScoreFilteredByMonths');
Route::get('/api/v1/nps/{survey_id}/{filter}/{modifier}', 'NpsController@getNpsScoreFilteredByModifier');
Route::get('/api/v1/nps/response/{survey_id}/{recipient_id}/{nps_score}', 'SurveyResponseController@requestSurveyResponse');
Route::controllers([
'auth' => 'AuthAuthController',
'password' => 'AuthPasswordController'
]);

即使检查我的routes.php-也没有显示错误:

php -l apphttproutes.php
No syntax errors detected in apphttproutes.php

尝试转到storage/framework并删除routes.php。我怀疑语法错误可能已缓存。

我有这个错误,但只是在本地计算机上运行时。若我在服务器上运行route:list,它运行得很好。问题是我的计算机使用的是PHP v5.6,服务器使用的是PHPv7.0。

我在控制器中使用了新的??运算符,所以它抛出了一个语法错误,因为PHP v5.6不理解该运算符。

最新更新