コード例 #1
0
ファイル: index.php プロジェクト: w3yyb/phalphp
 */
// Setup configuration files
$dir = dirname(__DIR__);
$appDir = $dir . '/app';
// Necessary requires to get things going
require $appDir . '/library/utilities/debug/PhpError.php';
require $appDir . '/library/interfaces/IRun.php';
require $appDir . '/library/application/Web.php';
// Necessary paths to autoload & config settings
$configPath = $appDir . '/config/';
$viewsPath = $appDir . '/views/';
$config = $configPath . 'config.php';
$autoLoad = $configPath . 'autoload.php';
$routes = $configPath . 'routes.php';
try {
    $app = new Application\Web();
    // Setup Web App (dependency injector, configuration variables, routes)
    $app->setAutoload($autoLoad, $appDir);
    $app->setConfig($config);
    $app->setRoutes($routes);
    $app->setSessions();
    //start session
    //$app->setDebugMode(TRUE);//debug
    $app->setView($viewsPath, $volt = TRUE);
    //$app->setEvents();
    //  Run
    $app->run();
} catch (Exception $e) {
    $app->response->setStatusCode(500, "Server Error");
    $app->response->setContent($e->getMessage());
    $app->response->send();
コード例 #2
0
ファイル: index.php プロジェクト: rasstroen/example
/**
 * путь до корневой директории
 */
$projectRoot = '/home/sites/balancer1.lj-top.ru/';
/**
 * Управляем кешом уровня nginx сразу - в случае любой ошибки, кеширование отключено.
 * Заголовок кеширования со временем отправляется при выводе в браузер, иначе - 0
 */
header('X-Accel-Expires: 0');
/**
 * Уровень ошибок
 */
error_reporting(E_ALL);
ini_set('display_errors', 1);
/**
 * Загружаем настройки проекта
 */
$configuration = (require_once $projectRoot . 'configs' . DIRECTORY_SEPARATOR . 'main.php');
/**
 * Autoloader
 */
require_once $projectRoot . 'lib' . DIRECTORY_SEPARATOR . 'AutoLoader.php';
AutoLoader::init($projectRoot, $configuration['includePathes']);
/**
 * Инициализируем приложение по загруженному конфигу
 */
$application = new \Application\Web($configuration);
/**
 * Запускаем приложение
 */
$application->run();