Php 路由组前缀:分析错误:语法错误,意外'';
我是新手。我第一次尝试使用前缀Php 路由组前缀:分析错误:语法错误,意外'';,php,laravel,laravel-5.3,Php,Laravel,Laravel 5.3,我是新手。我第一次尝试使用前缀 Route::get('/', function () { return view('welcome'); }); Auth::routes(); Route::get('/home', 'HomeController@index'); Route::group(['prefix' => 'admin','middleware' => ['admin']], function(){ Rout
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index');
Route::group(['prefix' => 'admin','middleware' => ['admin']], function(){
Route::get('/users', 'AdminUserController@index');
Route::get('/users/create', 'AdminUserController@create');
Route::get('/users/{id}', 'AdminUserController@store');
Route::get('/users/profile', function());
});
我不断地发现这个错误:
[Symfony\Component\Debug\Exception\fatalthrowayerror]
分析错误:语法错误,意外“;”
我已经注释掉了所有的路由
获取
,但仍然得到了错误路由::组()代码>
你的sinppet没有)代码>缺少闭合大括号
改变
到
我错过了{}:
路由::get('/users/profile',function())
路由::get('/users/profile',function(){}) Route::group(['middleware'=>'auth'],function(){Route::get('/',function(){//Uses auth middleware});
仍然会收到相同的错误您希望function()
做什么?});我不记得最后一个函数是否也需要大括号{},就是这样@JeffWinkler,如果答案解决了你的问题,请接受
Route::get('/users/profile', function());
Route::get('/users/profile', function({}));});