Phalcon处理404页面的 Ruter 方法

  /**

     * Initializes the router

     *

     * @param array $options

     */

    protected function initRouter($options = array())

    {

        $config = $this->di['config'];



        $this->di['router'] = function () use ($config) {



            $router = new PhRouter(false);



            $router->notFound(

                array(

                    "controller" => "index",

                    "action"     => "notFound",

                )

            );

            $router->removeExtraSlashes(true);



            foreach ($config['routes'] as $route => $items) {

                $router->add($route, $items->params->toArray())

                       ->setName($items->name);

            }



            return $router;

        };

    }

你可能感兴趣的:(404)