コード例 #1
0
function initialize($basePath, $packageName)
{
    error_reporting(-1);
    ini_set('html_errors', 'Off');
    ini_set('display_errors', 'Off');
    if (phpversion() < '5.5') {
        pr("PHP Version need >= 5.5");
        exit;
    }
    $autoload = $basePath . '/composer/vendor/autoload.php';
    if (!file_exists($autoload)) {
        die('Lose your composer!');
    }
    require_once $autoload;
    // init config
    ConfigManager::init($basePath . '/app/config');
    if (conf('app.path') !== $basePath) {
        pr('base path setting error!');
        exit;
    }
    if (isTraining()) {
        error_reporting(E_ALL);
        ini_set('html_errors', 'On');
        ini_set('display_errors', 'On');
    }
    date_default_timezone_set(conf('app.timezone'));
    // load Package
    switch ($packageName) {
        case 'home':
            include_once "/{$basePath}/app/{$packageName}Package/PackageSetting.php";
            $setting = new PackageSetting();
            $setting->set('basePath', $basePath);
            $setting->perform();
            break;
        default:
            throw new Exception('Warning! setting file error!');
            exit;
    }
}