or this for Json:$jsonModel = new JsonModel ( array ( 'calendars' => $calendars, ) );return $jsonModel;确保为您的控制器添加use语句:make sure to add the use statements for your controller:use Zend\View\Model\ViewModel;use Zend\View\Model\JsonModel;如果要指定特定视图,可以使用:If you want to specify a specific view you can use:$viewModel->setTemplate('path/to/specific/view.phtml');或$viewModel->setTemplate('mapping/for/specifc/view');具有在模块配置中指定的映射with the mapping specified in your module config 这篇关于如何在zf2中显示从文档到index.phtml的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
11-02 03:23