cha*_*cha 1 php zend-route zend-framework2
我创建了一个名为'currency'的新模块,并在module.config中配置了路由.它工作正常.之后我添加了一个名为CrateController的新控制器,用于货币汇率.还创建了表单,模型和视图文件.但它没有正确路由.
错误:
致命错误:未捕获的异常"的Zend \查看\异常\ RuntimeException的"有消息"的Zend \查看\渲染器\ PhpRenderer ::渲染:无法呈现模板'货币/箱/指数’; 解析器无法解析为文件....
任何线索来检查这将是有帮助的.
我的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',
),
),
),
),
),
Run Code Online (Sandbox Code Playgroud)
Sam*_*Sam 12
检查两件事:
第一:模板文件是否存在?./module/Currency/view/currency/crate/index.phtml
第二:检查里面的以下条目./Currency/config/module.config.php
'view_manager' => array(
'template_path_stack' => array(
'currency' => __DIR__ . '/../view',
)
),
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13831 次 |
| 最近记录: |