Zend framework2 ZF2捕获头样式辅助程序

Zend framework2 ZF2捕获头样式辅助程序,zend-framework2,Zend Framework2,我在我的应用程序中使用了以下代码 <?php $this->headStyle()->captureStart() ?> body { background-color: <?php echo $this->bgColor ?>; } <?php $this->headStyle()->captureEnd() ?> 身体{ 背景色:; } 我的视图脚本中出现此错误 致命错误:对非对象调用成员函数captureSta

我在我的应用程序中使用了以下代码

<?php $this->headStyle()->captureStart() ?>
body {
    background-color: <?php echo $this->bgColor ?>;
}
<?php $this->headStyle()->captureEnd() ?>

身体{
背景色:;
}
我的视图脚本中出现此错误

致命错误:对非对象调用成员函数captureStart()


有什么问题吗?

请在视图脚本的最顶端包含这一行,并转储输出:
。感谢您的回复。我跟着。但是,得到空页。我已经检查了视图源。如何呈现视图脚本?如果使用MVC等,你能粘贴控制器代码吗?我在这里发布了相同的代码。期待你有价值的回应。谢谢。注意:我使用的是ZF2。你的控制器和路由设置是什么样的?