我创建一个自定义渲染器并编辑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