error_reporting(E_ALL); $debug = new \Phalcon\Debug(); $debug->listen(); try { /** * Read the configuration */ $config = (include __DIR__ . "/../app/config/config.php"); /** * Read auto-loader */ include __DIR__ . "/../app/config/loader.php"; /** * Read services */ include __DIR__ . "/../app/config/services.php"; /** * Handle the request */ $application = new \Phalcon\Mvc\Application($di); $application->useImplicitView(false); echo $application->handle()->getContent(); } catch (Exception $e) { $debug = new \Phalcon\Debug(); $debug->listen(); echo "PhalconException:" . $e->getMessage() . '<br/>'; echo "File: " . $e->getFile() . '<br/>'; echo "Line: " . $e->getLine() . '<br/>'; print_r(get_class_methods($e)); print_r($config); }
<?php error_reporting(E_ALL); define('APP_PATH', dirname(__DIR__)); $loader = (require APP_PATH . '/vendor/autoload.php'); $config = (require APP_PATH . "/config/config.php"); $di = (require APP_PATH . "/config/services.php"); try { $app = new \Phalcon\Mvc\Application($di); $app->setEventsManager($di['eventsManager']); $app->useImplicitView(false); echo $app->handle()->getContent(); } catch (\Exception $e) { $di['logger']->error($e->getMessage() . "\n" . $e->getTraceAsString()); $di['response']->setStatusCode(500)->setContent("Internal error")->send(); }
/** * @param \Phalcon\DiInterface $di * * @return \Phalcon\Mvc\Application */ protected function getDefaultApplication(\Phalcon\DiInterface $di) { $application = new \Phalcon\Mvc\Application($di); $application->useImplicitView(false); return $application; }