Phalcon 3缓存解析模板但不返回它

时间:2017-04-10 12:40:32

标签: php phalcon volt

我在从Phalcon 2.0.x迁移到3.1.1时遇到问题 - 当我尝试使用Volt编译模板时,返回的输出为空。更有趣的是,正确解析的模板(即非空)存储在缓存文件夹中,但不会返回。这是我的代码片段:

$this->templateEngine->getView()->setVars($params);
                $this->templateEngine->getView()->start();
                $this->templateEngine->getView()->render(
                        $this->compiler->getOption('compiledPath'),
                        basename($compiledTemplateFile, $this->compiler->getOption('compiledExtension'))
                );
                $this->templateEngine->getView()->finish();

                return $this->templateEngine->getView()->getContent();

相同的代码适用于Phalcon 2.0,在PHP 5.6.25上运行(PHP版本未更改,仅使用新编译的PhalconPHP版本)。没有错误显示,也不会记录在错误日志中。我愿意接受建议,包括如果Phalcon遇到错误时如何调试,以及它为什么不返回输出。

1 个答案:

答案 0 :(得分:0)

我遇到了一些问题。 空模板和内容 这个问题就这样解决了:

phalcon 2.x

 $this->view->pick('/admin/events/list');

phalcon 3.x

$this->view->pick('admin/events/list');

不平凡,但有效!