php - Phalcon: not found page error handler -


how create 404 error page manual bootstrap example in app ? http://album-o-rama.phalconphp.com/

i use dispatcher :

$di->set( 'dispatcher', function() use ($di) {      $evmanager = $di->getshared('eventsmanager');      $evmanager->attach(         "dispatch:beforeexception",         function($event, $dispatcher, $exception)         {             switch ($exception->getcode()) {                 case phdispatcher::exception_handler_not_found:                 case phdispatcher::exception_action_not_found:                     $dispatcher->forward(                         array(                             'controller' => 'error',                             'action'     => 'show404',                         )                     );                     return false;             }         }     );     $dispatcher = new phdispatcher();     $dispatcher->seteventsmanager($evmanager);     return $dispatcher; }, true 

);

try in index.php:

$di->set('dispatcher', function() {      $eventsmanager = new \phalcon\events\manager();      $eventsmanager->attach("dispatch:beforeexception", function($event, $dispatcher, $exception) {          //handle 404 exceptions         if ($exception instanceof \phalcon\mvc\dispatcher\exception) {             $dispatcher->forward(array(                 'controller' => 'index',                 'action' => 'show404'             ));             return false;         }          //handle other exceptions         $dispatcher->forward(array(             'controller' => 'index',             'action' => 'show503'         ));          return false;     });      $dispatcher = new \phalcon\mvc\dispatcher();      //bind eventsmanager dispatcher     $dispatcher->seteventsmanager($eventsmanager);      return $dispatcher;  }, true); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -