duanjuda5789 2017-01-22 19:44
浏览 96
已采纳

Route.php第335行中的ReflectionException:Function()不存在,不知道为什么

I am learning Laravel framework and I have created simple project.

This is my code:

web.php

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

Route::get('/people', ['uses' => 'PeopleController@index']);

PeopleController.php

class PeopleController extends Controller
{
public function index()
{
    $users = [

        '0' =>[
            'first' => 'Alex',
            'last' => 'Shifu',
            'location' => 'Gotham'
        ]
    ];

    return view('people.index' , compact('people'));
}
}

index.blade.php

@foreach($people as $peep)
    <li>{!! $peep['first'] !!}</li>
@endforeach

These are the errors I am facing:

in RouteCollection.php line 161 at RouteCollection->match(object(Request)) in Router.php line 766 at Router->findRoute(object(Request)) in Router.php line 621 at Router->dispatchToRoute(object(Request)) in Router.php line 607 at Router->dispatch(object(Request)) in Kernel.php line 268 at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php line 53 at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 46 at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137 at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 33 at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 104 at Pipeline->then(object(Closure)) in Kernel.php line 150 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117 at Kernel->handle(object(Request)) in index.php line 54 at require_once('C:\wamp64\www\MyApp\public\index.php') in server.php line 21

  • 写回答

1条回答 默认 最新

  • dougong1031 2017-01-22 21:05
    关注

    The only problem I see is that you have to change $users to $people in your index() method.

    Other than that, everything looks fine.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 求快手直播间榜单匿名采集ID用户名简单能学会的
  • ¥15 DS18B20内部ADC模数转换器
  • ¥15 做个有关计算的小程序
  • ¥15 MPI读取tif文件无法正常给各进程分配路径
  • ¥15 如何用MATLAB实现以下三个公式(有相互嵌套)
  • ¥30 关于#算法#的问题:运用EViews第九版本进行一系列计量经济学的时间数列数据回归分析预测问题 求各位帮我解答一下
  • ¥15 setInterval 页面闪烁,怎么解决
  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历