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

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

图片转代码服务由CSDN问答提供 功能建议

我正在学习Laravel框架,我创建了一个简单的项目。</ p>

这 是我的代码:</ p>

web.php </ strong> </ p>

  Route :: get('/',function(  ){
return view('welcome'); 
}); 
 
Route :: get('/ people',['uses'=&gt;'PeopleController @ index']); 
 </ code>  </ pre> 
 
 

PeopleController.php </ strong> </ p>

 类PeopleController扩展Controller 
 {
公共函数索引()
  {
 $ users = [
 
'0'=&gt; [
'first'=&gt;  'Alex',
'last'=&gt;  'Shifu',
'location'=&gt;  'Gotham'
] 
]; 
 
返回视图('people.index',compact('people')); 
} 
} 
 </ code> </ pre> 
 \  n 

index.blade.php </ strong> </ p>

  @foreach($ people as $ peep)
&lt; li&gt; {!!  $ peep ['first'] !!}&lt; / li&gt; 
 @ endforeach 
 </ code> </ pre> 
 
 

这些是我所面临的错误:</ p>

在RouteCollection.php第161行 RouteCollection-&gt;匹配(对象(请求))在Router.php第766行 路由器 - &gt; findRoute(对象(请求)) 在Router.php第621行的 Router-&gt; dispatchToRoute(对象(请求))在Router.php第607行 路由器 - &gt; dispatch(对象(请求))在Kernel.php第268行 内核 - &gt; Illuminate \ Foundation \ Http {closure}(object(Request))在 Pipeline.php第53行 Pipeline-&gt; Illuminate \ Routing {closure}(object(Request))in CheckForMaintenanceMode.php 第4行 CheckForMaintenanceMode-&gt;句柄(对象(Request),对象(Closure))在 Pipeline.php第137行 Pipeline-&gt; Illuminate \ Pipeline {closure}(object(Request))in \ n Pipeline.php第33行位于 Pipeline-&gt; Illuminate \ Routing {closure}(object(Request))位于 Pipeline.php第104行的Pipeline-&gt;然后(object(Closure))在Kernel.php \ 在核心的第150行 - &g t; sendRequestThroughRouter(object(Request))位于/ n Kernel.php第117行,位于index.php 第54行中的Kernel-&gt;句柄(对象(请求)),位于require_once('C:\ wamp64 \ www \ MyApp \ public \ index.php')在 server.php第21行</ p> </ blockquote> </ div>

1条回答 默认 最新

相关推荐 更多相似问题