Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/279.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 路由组前缀:分析错误:语法错误,意外'';_Php_Laravel_Laravel 5.3 - Fatal编程技术网

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({}));});