Zend framework2 zend framework 2 setTemplate无法在主机上工作:错误无法呈现模板。。。解析程序无法解析为文件

Zend framework2 zend framework 2 setTemplate无法在主机上工作:错误无法呈现模板。。。解析程序无法解析为文件,zend-framework2,Zend Framework2,它在本地主机上正常工作,但在主机上出错: Zend\View\Renderer\PhpRenderer::render:无法呈现模板应用程序\Index\test;解析程序无法解析为文件 我的控制器: namespace Application\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class IndexController extends Ab

它在本地主机上正常工作,但在主机上出错:

Zend\View\Renderer\PhpRenderer::render:无法呈现模板应用程序\Index\test;解析程序无法解析为文件

我的控制器:

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class IndexController extends AbstractActionController
{
    public function indexAction()
    {
        $view=new ViewModel();
        $view->setTemplate('Application\Index\test');       
        $view->setVariable('view_chat', 'undercut');        
        return $view;
    }
    public function testAction(){

    }
}
查看文件夹:

-/应用

--/索引

---/index.phtml


---/test.phtml

在module.config.php中设置视图/局部视图:

yoursite\module\Application\config\module.config.php
在该文件中,您为要在站点中使用的分区设置了别名。 你是这样做的:

<?php 
 // .... Other stuff above
 'view_manager' => array(
     'template_map' => array(
           'test_view' => __DIR__ . '/../view/application/Index/test.phtml 
      )
  )

查找现有的模板地图,因为这是您的布局的参考位置。

谢谢,现在它可以工作了。但我很好奇为什么它在没有配置的情况下仍然可以在localhost上工作。
 $view->setTemplate('test_view');