<?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(); }
$compiler->addFilter('truncate', function ($resolvedArgs, $exprArgs) { $string = $exprArgs[0]['expr']['value']; $length = (int) $exprArgs[1]['expr']['value']; $end = isset($exprArgs[2]) ? $exprArgs[2]['expr']['value'] : '...'; return "mb_strimwidth({$string}, 0, {$length}, '{$end}', 'UTF-8')"; }); $compiler->addFilter('shift', function ($resolvedArgs, $exprArgs) { return "array_shift({$resolvedArgs})"; }); $compiler->addFilter('number_format', function ($resolvedArgs, $exprArgs) { return "number_format({$resolvedArgs})"; }); return $volt; })); // $view->setVar('FACEBOOK_ADMIN_ID', $config->facebook[ENVIRONMENT]->admin); // $view->setVar('GOOGLE_ANALYTICS_KEY', $config->ga[ENVIRONMENT]->key); return $view; }, true); $eventsManager = new \Phalcon\Events\Manager(); $eventsManager->attach("application:afterHandleRequest", function ($event, $application) { $datetime = gmdate("D, d M Y H:i:s") . ' GMT'; $application->response->setHeader('Last-Modified', $datetime); return true; }); $application = new \Phalcon\Mvc\Application($di); $application->setEventsManager($eventsManager); $application->registerModules(array(SITENAME => array('className' => 'Lininliao\\' . SITENAME . '\\Module', 'path' => ROOT . DS . 'apps' . DS . SITENAME . DS . 'Module.php'))); echo $application->handle()->getContent(); } catch (\Exception $e) { echo $e->getMessage(); }