0
我在HomeController.php2佈局在一個控制器
// other pages layout
protected $layout = "layout";
protected $layout2 = "layout2";
// empty user object
protected $user;
// constructor
public function __construct()
{
}
public function getAbout()
{
// share main home page only
$this->layout->content = View::make('about');
}
// THIS IS NOT WORKING >>>>
public function getAboutnew()
{
// share main home page only
$this->layout2->content = View::make('about');
}
所以getAboutNew
我想使用佈局2,但我得到了一個錯誤:
ErrorException (E_UNKNOWN) Attempt to assign property of non-object
如何解決這一問題?
$這 - >佈局2是一個字符串,而不是一個對象。 – 2014-09-03 19:31:45
$ this-> layout是一個對象,可以工作嗎? – user3150060 2014-09-03 19:32:08