Ejemplo n.º 1
0
<?php

use tourze\Base\Config;
use tourze\Base\I18n;
use tourze\Base\Message;
if (is_file(__DIR__ . '/vendor/autoload.php')) {
    require __DIR__ . '/vendor/autoload.php';
}
// 指定配置加载目录
Config::addPath(__DIR__ . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR);
// 语言文件目录
I18n::addPath(__DIR__ . DIRECTORY_SEPARATOR . 'i18n' . DIRECTORY_SEPARATOR);
// Message目录
Message::addPath(__DIR__ . DIRECTORY_SEPARATOR . 'message' . DIRECTORY_SEPARATOR);
Ejemplo n.º 2
0
 /**
  * 测试addPath方法是否OK
  *
  * @dataProvider dataAddPath
  * @param string $path
  */
 public function testAddPath($path)
 {
     Config::addPath($path);
     $currentPaths = Config::getPaths();
     $this->assertTrue(isset($currentPaths[$path]));
 }
Ejemplo n.º 3
0
<?php

use tourze\Base\Config;
use tourze\Route\Route;
use tourze\StatServer\Cache;
use tourze\View\View;
if (is_file(__DIR__ . '/vendor/autoload.php')) {
    require_once __DIR__ . '/vendor/autoload.php';
}
ini_set('display_errors', 'on');
if (!defined('ROOT_PATH')) {
    define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
if (!defined('WEB_PATH')) {
    define('WEB_PATH', ROOT_PATH . 'web' . DIRECTORY_SEPARATOR);
}
Config::addPath(ROOT_PATH . 'config' . DIRECTORY_SEPARATOR);
View::addPath(ROOT_PATH . 'view' . DIRECTORY_SEPARATOR);
Cache::$serverIpList = Config::load('statServer')->get('serverIpList');
// 指定控制器命名空间
Route::$defaultNamespace = '\\tourze\\StatServer\\Controller\\';
Route::set('stat-web', '(<controller>(/<action>(/<id>)))')->defaults(['controller' => 'Main', 'action' => 'index']);
// 创建类别名
@class_alias('\\tourze\\StatServer\\Protocol\\Statistic', '\\Workerman\\Protocols\\Statistic');