【发布时间】:2017-06-07 07:33:20
【问题描述】:
我正在学习 Laravel 框架,并创建了一个简单的项目。
这是我的代码:
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
这些是我面临的错误:
在 RouteCollection.php 第 161 行 Router.php 第 766 行中的 RouteCollection->match(object(Request)) Router->findRoute(object(Request)) 在 Router.php 第 621 行 Router->dispatchToRoute(object(Request)) 在 Router.php 第 607 行 Kernel.php 第 268 行中的 Router->dispatch(object(Request)) Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php 第 53 行 Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php 第 46 行,位于 CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php 第 137 行 Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php 第 33 行 Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php 第 104 行位于 Kernel.php 的 Pipeline->then(object(Closure)) 第 150 行 Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php 第 117 行位于 Kernel->handle(object(Request)) in index.php 第 54 行 require_once('C:\wamp64\www\MyApp\public\index.php') 在 server.php 第 21 行
【问题讨论】: