本文整理汇总了PHP中app\Config::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::load方法的具体用法?PHP Config::load怎么用?PHP Config::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Config
的用法示例。
在下文中一共展示了Config::load方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
public static function connect($section = 'default')
{
static $caches = [];
if (isset($caches[$section])) {
return $caches[$section];
}
$conf = \app\Config::load('database', $section);
return $caches[$section] = new self($conf);
}
示例2: load
private static $config;
public static function load()
{
$yaml = new Yaml();
self::$config = $yaml->parse(file_get_contents("../app/config/config.yml"));
}
public static function get($key = null)
{
if ($key !== null) {
return self::$config[$key];
} else {
return self::$config;
}
}
}
Config::load();
$path = explode('/', $_SERVER["PATH_INFO"] ? $_SERVER["PATH_INFO"] : "/default");
array_shift($path);
$ctrl = array_shift($path);
if (count($path)) {
$action = array_shift($path);
} else {
$action = "index";
}
try {
$ctrlClass = "App\\Controllers\\Ajax\\" . $ctrl . "Controller";
$ctrlAction = $action . "Action";
$controller = new $ctrlClass();
echo $controller->{$ctrlAction}();
} catch (Exception $e) {
}
示例3: catch
<?php
require_once 'engine/utils.php';
require_once 'engine/autoload.php';
Autoload::init('config/autoload.php');
use App\Config, App\Request, App\User, App\Route, App\View, App\Timer, App\Debug, App\Mysql, App\Response;
try {
Config::load('config/settings.php');
Config::applyHostSettings('config/hosts.php');
Mysql::setHost(Config::get('dbConnection'));
Timer::start();
User::startSession();
Request::parse();
Route::add(['/dumper' => 'dumper', '/module' => 'module', '/login' => 'login', '/tasks' => 'page', '/profile' => 'page', '/projects' => 'page', '/workspace' => 'page', '/404' => 'error', '/' => 'page']);
Route::go();
Timer::showExecutionTime();
Mysql::showResources();
Response::out();
} catch (\Exception $e) {
Debug::showException($e);
}