【发布时间】:2014-09-26 18:03:00
【问题描述】:
我定义了我的方法控制器 index() 并传递参数标题以在我的 html 视图中显示:
class WebController extends BaseController{
public $layout = 'layout.base';
/*Index*/
public function index(){
$this->layout->title = 'Index Title';
return View::make('pages.index');
}
}
但是当我加载页面时返回此错误:
在我的 'app\views\layout\base.blade.php' 我有:
<!DOCTYPE html>
<html lang="es">
<head>
<title>{{$title}}</title>
@section('metas')
@show
@section('styles')
@show
</head>
这是我的 route.php:
Route::get('/index',['as' => 'pages.index', 'uses' => 'WebController@index']);
如何解决这个问题? 非常感谢!
【问题讨论】:
-
您的索引控制器正在创建视图
pages/index.blade.php但您显示来自layout\base.blade.php的错误