gpt4 book ai didi

php - Zend 静态助手

转载 作者:行者123 更新时间:2023-12-04 18:19:27 25 4
gpt4 key购买 nike

在我的 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com