doormen2014 2014-07-16 08:41
浏览 89
已采纳

Zend framework2 +带参数的路由

I want to write custom routing in Zend framework2. I prepared following code:

'objects' => array(
            'type' => 'Literal',
            'options' => array(
                'route' => '/objects',
                'defaults' => array(
                    '__NAMESPACE__' => 'Application\Controller',
                    'controller' => 'Index',
                    'action' => 'decode',
                ),
            ),
            'may_terminate' => true,
            'child_routes' => array(
                'default' => array(
                    'type' => 'Segment',
                    'options' => array(
                        'route' => '/[:mask]',
                        'constraints' => array(
                            'mask' => '[a-zA-Z][a-zA-Z0-9_-.,]*',
                        ),
                        'defaults' => array(

                        ),
                    ),
                ),
            ),
        ),

I must routing adres like this:

http://restaurations.en/objects/cracow,0.html

http://restaurations.en/objects/cracow,swam,1.html

http:restaurations.en/objects/swam,3.html

The blod text I must get in my controller. Also, How should I prepre corect router?? How can I do it?

  • 写回答

1条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥20 苹果app名字侵权商标,我投诉了,但是苹果一直没回怎么办
      • ¥15 Android studio运行不成功总是报错
      • ¥15 pycharm 加载软件包列表时出错connect timed out
      • ¥20 数字方面的问题,请给个思路
      • ¥15 和您碰到了同一个问题
      • ¥15 如何在微信支付V3PHP版请求中添加header?
      • ¥15 在数字信号处理中用MATLAB显示波形。
      • ¥15 keil MDK软件进行仿真调试的局限
      • ¥15 关于gateway产生临时文件夹的问题
      • ¥15 Java Broken Pipe以及OOM