Вопрос

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