【问题标题】:FatalErrorException in routes.php line 20: syntax error, unexpected 'get' (T_STRING)routes.php 第 20 行中的 FatalErrorException:语法错误,意外的“获取”(T_STRING)
【发布时间】:2018-04-10 18:12:31
【问题描述】:

我有新的 Laravel 5.1,我在关注 this guide 时得到了这个。

FatalErrorException in routes.php line 20:
syntax error, unexpected 'get' (T_STRING)

这是我的 routes.php:

    <?php
    get('/', function() {
    return view('vue1')
});

get('article/{n}', 'ArticleController@show')->where('n', '[0-9]+');



get('article/{n}', function($n) { 
    return view('article')->with('numero', $n); 
})->where('n', '[0-9]+');

get('users', 'UsersController@getInfos');
post('users', 'UsersController@postInfos');

我该如何解决这个错误?

【问题讨论】:

    标签: laravel-5.1


    【解决方案1】:

    您的所有路线都缺少 Route:: 外观。 将它们更正为以下示例:

    <?php
    Route::get('/', function() {
       return view('vue1')
    });
    Route::post('users', 'UsersController@postInfos');
    

    【讨论】:

      猜你喜欢
      • 2016-06-29
      • 1970-01-01
      • 2018-07-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多