如何从zend框架2中的url中删除控制器名称和操作名称

时间:2014-11-05 13:22:00

标签: zend-framework2

我的网址似乎是:

http://test.scampaigns.com/New/index/qwertyui/287

我想成为:

http://test.scampaigns.com/qwertyui/287

这怎么可能?

router.config.php添加了......

'new' => array(

    'type' => 'segment',
                'options' => array(
                    'route' => '/[/:id][/:pId]',
                    'constraints' => array(
                        'id' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'pId' => '[0-9]+',
                    ),
                    'defaults' => array(
                        'controller' => 'Application\Controller\New',
                        'action' => 'index',
                    ),
                ),
            ),

controllers.config.php

'controllers' => array(

    'invokables' => array(
            'Application\Controller\New' => 'Application\Controller\NewController'
        ),
    ),

1 个答案:

答案 0 :(得分:0)

我真的在Zend做了一些项目,但我记得,这将是关于路线的事情。

检查StackOverflow的这个问题和答案,那里有一个很好的解释,也可以指导你。

Routing in Zend Framework 2

相关问题