About the routes config ,is it the design problem?

$config = array(
    'best-url' => array(
        'pattern' => '/best',
        'paths' => array(
            'controller' => 'cate',
            'action' => 'index?cate_id=1',
        ),
    ),
    'better-url' => array(
        'pattern' => '/better',
        'paths' => array(
            'controller' => 'cate',
            'action' => 'index?cate_id=2',
        ),
    ),
    'cate-url' => array(
        'pattern' => '/cate/index/:int',
        'paths' => array(
            'controller' => 'cate',
            'action' => 'index',
            'cate_id' => '1'
        ),
    )
);

I have a requirement that ,the url map to the cateid like /best -> /cate/index?cateid=1,/better -> /cate/index?cateid = 2,I don't know how to config my routes,I had solve it above,but I need it auto reverse routing when I use $url->get('for'=>'cate-url','cateid'=>1) it can not create the url like /best or /better. How can I solve it, thanks.



83.4k

Are you disabling default routes?

// Create the router without default routes
$router = new \Phalcon\Mvc\Router(false);

http://docs.phalconphp.com/en/latest/reference/routing.html#default-behavior

Thanks your reply,the forum can reply eventually.

Are you disabling default routes?

```php // Create the router without default routes $router = new \Phalcon\Mvc\Router(false); ```

http://docs.phalconphp.com/en/latest/reference/routing.html#default-behavior