本文整理汇总了PHP中Registry::init方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::init方法的具体用法?PHP Registry::init怎么用?PHP Registry::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Registry
的用法示例。
在下文中一共展示了Registry::init方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
private function init()
{
Registry::init();
$this->displayErrors();
//this method has to be called before instantiating the autoloader because it's not namespaced
$this->enableLoggers();
//this method has to be called before instantiating the autoloader because it's not namespaced
$this->initTwig();
$this->initAutoloader();
$this->initErrorHandler();
$this->initExceptionHandler();
$this->startController();
}
示例2: run
/**
* 运行一个请求生命周期
* @access public
* @author songdengtao <http://www.songdengtao.cn>
* @return void
*/
public static function run()
{
// 系统注册表
Registry::init(static::get('registryPath'));
// 运行环境检查
static::checkEnv();
// 类文件自动加载
Autoloader::init(static::getInstance());
Autoloader::autoload();
// 设置系统时区
static::shell('Dtime::setDateDefaultTimeZone');
// 设置错误处理方法
static::shell('Error::registerShutdownFunction');
static::shell('Error::setErrorHandler');
// 设置异常处理方法
static::shell('Exception::setExceptionHandler');
if (false === static::get('isCli')) {
static::shell('Filter::globalFilter');
static::shell('Session::start');
}
// 路由
static::shell('Router::dispatch');
$controller = CONTROLLER_NAME . 'Controller';
$action = ACTION_NAME . 'Action';
$class = CONTROLLER_NAMESPACE . '\\' . $controller;
if (!class_exists($class)) {
$class = CONTROLLER_NAMESPACE . '\\EmptyController';
if (!class_exists($class)) {
$module = strstr(CONTROLLER_NAMESPACE, '\\', true);
if (static::get('debug')) {
if (!is_dir(static::get('appPath') . $module)) {
static::shell('Error::halt', 'Call to undefined module ' . $module);
} else {
static::shell('Error::halt', 'Call to undefined controller ' . $class);
}
} else {
static::shell('Error::halt', '404 Not found');
}
}
}
(new $class())->{$action}();
return;
}
示例3: __constructLinkedModel
function __constructLinkedModel($assoc, $className = null)
{
if (empty($className)) {
$className = $assoc;
}
if (!isset($this->{$assoc}) || $this->{$assoc}->name !== $className) {
$model = array('class' => $className, 'alias' => $assoc);
if (PHP_VERSION >= 5) {
$this->{$assoc} = Registry::init($model);
} else {
$this->{$assoc} =& Registry::init($model);
}
}
}
示例4:
<?php
$CFG->load('database');
$DB = Mysql::init($CFG->get('mysql_host'), $CFG->get('mysql_user'), $CFG->get('mysql_password'), $CFG->get('mysql_database'));
$DB->set_names();
Registry::init()->set('DB', $DB);
$CFG->unload('database');
示例5: dirname
<?php
//Object Factory
require_once dirname(__FILE__) . "/model/core/Factory.php";
require_once dirname(__FILE__) . "/model/core/Autoloader.php";
$autloader = new model\core\Autoloader();
$autloader->register();
Factory::init();
Controller::boot();
Registry::init();
Cache::init();
Registry::loadDBSettings();
FrameEx::init();
Factory::attachAutoloader($autloader);
//boot the app
Factory::boot(APP_DIR);
示例6: assign
function assign($key, $value)
{
return Registry::init()->smarty->assign($key, $value);
}
示例7: define
// setam caile de acces catre system, fisierele de configuratie si module
define('SYSPATH', BASEPATH . 'system' . DS);
define('CFGPATH', APPPATH . 'config' . DS);
define('MODPATH', BASEPATH . 'modules' . DS);
define('PLUGINPATH', BASEPATH . 'plugins' . DS);
require SYSPATH . 'autoload.php';
// setam ca functia implicita sa fie metoda load din clasa Autoload
spl_autoload_register();
spl_autoload_register(array('Autoload', 'load'));
// deschidem sesiunea
Session::start('metin2fw');
// functii globale facute de utilizator (programator)
require SYSPATH . 'functions.php';
require SYSPATH . 'constants.php';
//
$CFG = Config::init();
$REG = Registry::init();
// includem declararea bazei de date
require SYSPATH . 'database.php';
// wrapper pentru metodele claselor
require SYSPATH . 'wrapper.php';
// Functii ce ne ajut sa lucram cu smarty
require SYSPATH . 'smarty.php';
// pre-config
set_sitename($CFG->get('site_name'));
$smarty->assign('keywords', $CFG->get('site_keywords'));
$smarty->assign('site_description', $CFG->get('site_description'));
$smarty->assign('site_lang', $CFG->get('site_lang'));
$smarty->assign('base_href', site_url());
$smarty->assign('banners', $CFG->get('banners'));
date_default_timezone_set($CFG->get('default_timezone'));