Exemple #1
0
 * HTTPS support:
 * Use HTTPS connection when necessary, needs to config apache/nginx manually
 */
define('HTTPS_SUPPORT', true);
/**
 * Enable debug mode:
 * Disable debug mode will hide backtrace information, which is helpful for developer
 */
define('DEBUG_ENABLE', true);
/**
 * Real time mode:
 * This option will disable i18n / router / template cache, development only.
 * DO NOT TURN ON THIS OPTION IN PRODUCTION!!!
 */
define('REAL_TIME_MODE', false);
/**
 * Base URL:
 * To manually config this, uncomment the following line and change the URL
 * To use auto detect, keep this commented
 */
// define('BASE_URL', 'http://www.kookxiang.com');
Core\Request::autoDetectBaseURL();
/**
 * Set i18n translation file
 * If you don't need this, simply comment out the following line
 */
Core\I18N::setTranslationFile(LIBRARY_PATH . 'Language/en-US.yml');
/**
 * Database Connection:
 */
Core\Database::initialize('mysql:dbname=test;host=localhost;charset=UTF8', 'root', '');
Exemple #2
0
<?php

/**
 * KK-Framework
 * Author: kookxiang <*****@*****.**>
 */
// Initialize constants
define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
define('LIBRARY_PATH', ROOT_PATH . 'Library/');
define('DATA_PATH', ROOT_PATH . 'Data/');
@ini_set('display_errors', 'on');
@ini_set('expose_php', false);
// Register composer
require ROOT_PATH . 'Package/autoload.php';
// Register error handler
Core\Error::registerHandler();
// Initialize config
@(include DATA_PATH . 'Config.php');
if (ini_get('opcache.enable')) {
    if (!ini_get('opcache.save_comments')) {
        throw new \Core\Error('ZendOpcache is configured not saving PHP DocComments which is required.');
    }
}
// Initialize i18n engine
Core\I18N::init();
// Handler for json request
Core\Filter::register(new Helper\JSON());
//$Router = new Core\DefaultRouter();
$Router = new Core\ReflectionRouter();
$Router->handleRequest();