我创建了名为“货币”的新模块,并在 module.config 中配置了路由。它工作正常。之后,我为货币汇率添加了名为 CrateController 的新控制器。还创建了表单、模型和视图文件。但它没有正确路由。
错误:
致命错误:未捕获的异常 'Zend\View\Exception\RuntimeException' 带有消息 'Zend\View\Renderer\PhpRenderer::render: Unable to render template "currency/crate/index"; 解析器无法解析到文件....
任何检查这一点的线索都会有所帮助。
我的 module.config 文件如下。
return array(
'controllers' => array(
'invokables' => array(
'Currency\Controller\Currency' => 'Currency\Controller\CurrencyController',
'Currency\Controller\Crate' => 'Currency\Controller\CrateController',
),
),
// The following section is new and should be added to your file
'router' => array(
'routes' => array(
'currency' => array(
'type' => 'segment',
'options' => array(
'route' => '/currency[/:action][/:currency_id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'currency_id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Currency\Controller\Currency',
'action' => 'index',
),
),
),
'crate' => array(
'type' => 'segment',
'options' => array(
'route' => '/crate[/:action][/:c_rate_id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'c_rate_id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Currency\Controller\Crate',
'action' => 'index',
),
),
),
),
),