<?php

use Phalcon\Mvc\Application;
date_default_timezone_set('Asia/Shanghai');
ini_set('display_errors', 1);
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT);
define('IN_ADMIN', true);
header('P3P: CP="CAO PSA OUR"');
try {
     define('APP_PATH', realpath('..') . '/');
    /**
     * Read the configuration
     */
    $config = require __DIR__ . '/../config/config.php';
   
    define('BASE_URI', $config->application->baseUri);
    /**
     * Include constants
     */
    require __DIR__ . '/../config/constants.php';
    /**
     * Auto-loader configuration
     */
    require __DIR__ . '/../config/loader.php';

    /**
     * Include services
     */
    require __DIR__ . '/../config/services.php';



    /**
    * Handle the request
    */
    $application = new Application($di);
    $request = \Phalcon\DI::getDefault()->get('request');
    
    //形如 http://localhost/dev/app这种URL前缀
    define('URL_PREFIX', $request->getScheme().'://'.$request->getHttpHost().BASE_URI);

    $content = $application->handle()->getContent();
    
    echo $content;

} catch (Exception $e) {
    print_r($e->getMessage());
}
