本文整理汇总了PHP中config::init方法的典型用法代码示例。如果您正苦于以下问题:PHP config::init方法的具体用法?PHP config::init怎么用?PHP config::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类config
的用法示例。
在下文中一共展示了config::init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* quickbox::__construct()
*
* @param array $init Initialization configuration
*
* Constructor which basically creates quickbox
* and readies it for doing things.
*/
public function __construct ($init)
{
# We need to include initialize the config class because it allows us to get and
# set configuration variables without using a global
require $init['quickbox/path'] . '/classes/core/config.class.php';
config::init($init);
define(DEBUG, config::get('debug'));
# Start a database connection
$this->db = new database();
try
{
$this->db->init();
} catch (Exception $e)
{
trigger_error(text::get('system/fatalError',$e->getMessage()), E_USER_ERROR);
}
require $init['quickbox/path'] . '/classes/core/metaclass.class.php';
metaclass::init($this->db);
# Put the post and get variables into a private for later use.
$_POST = $_POST;
$this->qbGet = $_GET;
# Start the session, giving it the database connection.
$this->qbSession = new session($this->db);
if ($this->qbGet['page'] == 'logout')
{
$this->qbSession->logout();
}
$this->qbSession->checkCookie();
if (strlen($_POST['user']) > 0 && $_POST['login'] == 1)
{
$this->qbErrors['login'] = $this->qbSession->login($_POST['user'], $_POST['password']);
}
$this->qbPage = ($_GET['page'] ? janitor::cleanData($_GET['page']) : 'home');
}
示例2: initConfig
/**
* 初始化获取配置文件
* @return void
*/
public function initConfig()
{
config::init();
}
示例3: get
}
}
/**
* Get configuration parameter by key
* @param string $key data-array key
* @return null
*/
public static function get($key)
{
if (isset(self::$_data[$key])) {
return self::$_data[$key];
}
return null;
}
}
config::init();
function __autoload($class)
{
scan(config::get('base_path'), $class);
}
function scan($path = '.', $class)
{
$ignore = array('.', '..');
$dh = opendir($path);
while (false !== ($file = readdir($dh))) {
if (!in_array($file, $ignore)) {
if (is_dir($path . DIRECTORY_SEPARATOR . $file)) {
scan($path . DIRECTORY_SEPARATOR . $file, $class);
} else {
if ($file === 'class.' . $class . '.php') {
require_once $path . DIRECTORY_SEPARATOR . $file;
示例4: onLoad
/**
* Gets called on single instance being selected initially.
*
*/
public function onLoad()
{
// install class autoloader
spl_autoload_register(array(get_class($this), 'classAutoloader'));
// analyse pathnames and prepare context for addressing related resources
$this->context = new context();
if (!is_dir($this->context->application->pathname)) {
throw new \InvalidArgumentException('no such application');
}
// declare some constants for improving performance on accessing TXF context
define('TXF_INSTALL_PATH', $this->context->installationPathname);
define('TXF_FRAMEWORK_PATH', $this->context->frameworkPathname);
define('TXF_URL', $this->context->url);
define('TXF_APPLICATION', $this->context->application->name);
define('TXF_APPLICATION_PATH', $this->context->application->pathname);
define('TXF_APPLICATION_URL', $this->context->application->url);
define('TXF_SCRIPT_PATH', $this->context->application->script);
define('TXF_SCRIPT_NAME', pathinfo(TXF_SCRIPT_PATH, PATHINFO_FILENAME));
// prepare URL prefix to use on compiling relative URLs pointing to
// current application's public root
define('TXF_RELATIVE_PREFIX', $this->context->application->relativePrefix());
// start runtime configuration support
config::init();
// support configuration option to enable/disable errors displayed in output
ini_set('display_errors', config::get('php.display_errors', false));
// enable internal class redirection support
$this->initializeClassRedirections();
// open managed session space
$this->session = session::current();
/*
* basically put further initialization below this comment
*/
}