gpt4 book ai didi

php - Zend Framework,传递变量查看

转载 作者:行者123 更新时间:2023-12-01 14:01:47 25 4
gpt4 key购买 nike

我在显示 View 时遇到问题。当我将 var 传递给 View 时, View 不呈现。

Controller :

public function indexAction()
{
$branchModel = new Application_Model_Branches();
$branches = $branchModel->getAllBranches();
$this->view->menu = $branches;
}

View (index.phtml):

<h2>Menu</h2>
<?php
$this->htmlList($this->menu);
?>

当我尝试调试 $branches 而不将其分配给 View 时,一切似乎都正常,但是当我尝试将其推送到 View 时,index.phtml 没有出现。

问候

最佳答案

您只是在代码中缺少回显,htmlList View 助手返回一个值 - 它不会回显它。可以看到各种表单 View 助手的一些示例 here

<h2>Menu</h2>
<?php
echo $this->htmlList($this->menu);
?>

关于php - Zend Framework,传递变量查看,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3772138/

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