Phalcon路线组404不起作用

时间:2018-01-02 15:41:53

标签: php routes phalcon

我有网址:

site.com/sdfsdfsdfsd - 404工作

site.com/ru/page/sdfasdfasfasdfsad - 无法正常工作,我会重定向到主页

$router->add('/', array(
  'module' => 'frontend',
  'controller' => 'index',
  'action' => 'index',
  'lang' => 'md',
))->setName('default');

$router->add('/{lang:[' . $langsDefined . ']{2}+}(/?)', array(
  'module' => 'frontend',
  'controller' => 'index',
  'action' => 'index',
  'lang' => 1,
))->setName('default_lang');

我如何解决这个问题?

$router = new \Phalcon\Mvc\Router(false);
$router->notFound(array(
  "controller" => "Notfound",
  "action" => "index"
));

方法NotFound无效。我重定向到主页!

1 个答案:

答案 0 :(得分:0)

请注意命名空间,你可以这样试试:

$router->notFound(array(
    "module" => "frontend",
    "controller" => "Notfound",
    "action" => "index"
));