Zend Framework 3中的自定义视图策略

时间:2019-01-11 14:52:26

标签: php zend-framework zend-framework3

我创建一个自定义渲染器并编辑Admin \ config \ module.config.php

'service_manager' => [
        'factories' => [
                View\Renderer::class => function($serviceManager){
                     return new Renderer('ISO-8859-1');
                },
                'MyStrategy' => function($serviceManager){
                     $render = $serviceManager->get(View\Renderer::class);
                     $strategy = new PhpRendererStrategy($render);
                     return $strategy;
                },

 'view_manager' => [
    ...
    'strategies' => [
        'ViewJsonStrategy',
        'MyStrategy'
    ]

但发生跟随错误:

  Fatal error: Uncaught Zend\View\Exception\RuntimeException: Zend\View\Renderer\PhpRenderer::render: Unable to render template "error/index"; resolver could not resolve to a file in C:\xampp\htdocs\zf3dashboard\vendor\zendframework\zend-view\src\Renderer\PhpRenderer.php:498

0 个答案:

没有答案