Zend framework 在生产服务器上呈现布局

Zend framework 在生产服务器上呈现布局,zend-framework,zend-framework3,zend-layout,Zend Framework,Zend Framework3,Zend Layout,我的productionserver无法呈现我的登录布局。在我的开发系统中,一切正常 以下是制作网站上的错误: 致命错误:未捕获Zend\View\Exception\RuntimeException:Zend\View\Renderer\PhpRenderer::render:无法呈现模板“布局/布局登录” 我是如何做到这一点的: MyApplication/config/module.config.php提供了如下模板: 'view_manager' => [ 'dis

我的productionserver无法呈现我的登录布局。在我的开发系统中,一切正常

以下是制作网站上的错误:

致命错误:未捕获Zend\View\Exception\RuntimeException:Zend\View\Renderer\PhpRenderer::render:无法呈现模板“布局/布局登录”

我是如何做到这一点的:

My
Application/config/module.config.php
提供了如下模板:

'view_manager' => [
        'display_not_found_reason' => true,
        'display_exceptions'       => true,
        'doctype'                  => 'HTML5',
        'not_found_template'       => 'error/404',
        'exception_template'       => 'error/index',
        'template_map' => [
            'layout/layout'           => __DIR__ . '/../view/layout/layout.phtml',
            'layout/layoutlogin'      => __DIR__ . '/../view/layout/layoutlogin.phtml',
            'application/index/index' => __DIR__ . '/../view/application/index/index.phtml',
            'error/404'               => __DIR__ . '/../view/error/404.phtml',
            'error/index'             => __DIR__ . '/../view/error/index.phtml',
        ],
        'template_path_stack' => [
            __DIR__ . '/../view',
        ],
    ],
在我的Indexcontroller中,我将布局设置为:

$this->layout()->setTemplate('layout/layoutlogin');
那可能是我想要的!?在开发环境的开发模式中,我没有收到任何错误和警告。任何想法都值得赞赏

你可以这样试试

public function loginAction()
{
    // Provide the layout here
    $this->layout('layout/layoutlogin');

    $view = new ViewModel();

    // Here you may set the template
    $view->setTemplate("/module/controller/template");

    return $view;
} 

这实际上意味着您使用的布局不是默认布局,然后在此布局中,您可以使用所需的模板进行此操作。

错误已解决。实际上这是一个服务器配置问题。在本例中,是因为Apache没有足够的文件夹权限

数据/缓存


它在本地开发系统上工作,而不是在产品上工作,这是什么原因呢?我甚至停用了每一个$this->layout某物,它不起作用。我不确定代码背后发生了什么。我有一些问题要问你!你的php版本是什么?您是否禁用了开发环境?如果未使用此
编写器,请通过编写器禁用
。您使用的php开始标记是什么?“它解决了,就像我猜的那样,它肯定是一台服务器!你成功了!:)那么,它已经修复了?