문제

My problem is about routing in Zend Framework 2. In my ZF2 application, older router was like route => '/app/[:/someParams]'. Now, I'm trying to make dynamic for my site for example about-us. I'm using unique slug name for dynamic pages. Every thing works fine. But when that url becomes like /application then it identifies as a first route. So, route conflicts are happening.

도움이 되었습니까?

해결책

Try with priority if conflicts happen

priority with high rank is the highest priority for the router to check the right route.

return array(
    'router' => array(
        'routes' => array(
            'admin' => array(
                'type' => 'Zend\Mvc\Router\Http\Literal',
                'priority' => 100,             // <----
                'options' => array(
                    'route'    => '/admin',
                    'defaults' => array(
                        'controller' => 'Admin\Controller\Admin',
                        'action'     => 'index',
                    ),
                ),
             ),
         ),
      ),
   ),

about the route you describe, use Segment to define some parameters (:/SomeParams)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top