我刚开始玩laravel。首先,这是我遇到过的最好的框架。这是我的问题。我试图从路由指向->控制器->视图
//This is my Controller file
public function index()
{
return View::make('pages', array('name' => 'Taylor'));
}
// This is my Routes File
Route::get('/', 'pagesController@index');
View file => pages.blade.php
这是我得到的错误。
FatalErrorException in pagesController.php line 19:
Class 'App'Http'Controllers'View' not found
从错误看来,问题是View
类在当前命名空间中找不到。
试试这样:
//use the View class from the global namespace
return 'View::make('pages', array('name' => 'Taylor'));
或者在控制器脚本的开头导入View
类:
use View;