于是安装了Zend最新的2.0版本。我无法在控制器中定义视图然后显示。如果我创建一个新的 ViewModel 并返回它,它工作正常。例如。
public function __construct()
{
$this->view = new ViewModel();
}
$this->view->hello="hey";
$this->view->test="there";
return $this->view;
但在 Zend 1.8 或更早版本中,我从来不需要这样做。在不创建新模型的情况下,它给了我以下错误:
Strict Standards: Creating default object from empty value in /path-to-controller-file.php
我必须将它设置在其他地方吗?