Zend 1 - 渲染视图到变量返回空字符串

时间:2016-06-08 12:45:33

标签: php zend-framework

我在控制器中有两个功能。调用控制器indexAction()后加载的操作和将数据设置为 view 的私有函数generateInvoice($id)

        public function indexAction() {
           $this->generateInvoice('48313');
           var_dump($this->view->tax); // prints tax, view has desired data
           $htmlcontent = $this->view->render();
           $this->setNoRender();
           var_dump($htmlcontent); // returns string '' (length=0)
         }

         private function generateInvoice($id) {
            $this->view->id = $id;
            $this->view->other_variables = $their_values;
            ...
         }

调用它之后,Zend var只转储了一个空字符串。但是,当我删除$this->setNoRender();时,我的 index.phtml 文件已加载,所有内容都很好 - 不幸的是,不是我的变量,但它会打印在屏幕上,我不知道我想要。

我没有在网上找到任何提示,为什么$htmlcontent = $this->view->render();在我的情况下不起作用。有什么想法吗?

0 个答案:

没有答案
相关问题