在我的 Bootstrap.php 文件中,我有以下代码
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if (null === $viewRenderer->view)
{
$viewRenderer->initView();
}
$view = $viewRenderer->view;
$view->assign('CSS_PATH', 'path/to/css');
在layout.phtml中我可以访问$this->CSS_PATH,但在 Controller 中不行。 那么如何在任何 Controller 中访问它?
最佳答案
在 Controller 中执行
echo $this->view->CSS_PATH ;
关于php - Zend 静态助手,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10992761/