[英]Problem 1 - Conclusion: don't install zendframework/zend-cache
[英]ZendFramework autoRouting don't work
// The following is a route to simplify getting started creating
// new controllers and actions without needing to create a new
// module. Simply drop new controllers in, and you can access them
// using the path /application/:controller/:action
'application' => array(
'type' => 'Literal',
'options' => array(
'route' => '/application',
'defaults' => array(
'__NAMESPACE__' => 'Application\Controller',
'controller' => 'Index',
'action' => 'index',
),
),
'may_terminate' => true,
'child_routes' => array(
'default' => array(
'type' => 'Segment',
'options' => array(
'route' => '/[:controller[/:action]]',
'constraints' => array(
'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
),
'defaults' => array(
),
),
),
),
),
我已經使用類TestController創建了一個TestController.php,其中有一個方法indexAction,但是如果我編寫/ application / index / test或/ application / index / index,則無法使用此路由執行它-沒關系,但是如果我將控制器更改為“測試它不起作用”,是指/ application / test / test或/ application / test / index
不要忘記將新的控制器添加到Application的module.config.php的controllers ['invokables'] config部分中:
'controllers' => array(
'invokables' => array(
'Application\Controller\Index' => 'Application\Controller\IndexController',
'Application\Controller\Test' => 'Application\Controller\TestController',
),
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.