本文整理汇总了PHP中Am_Di::_setInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Di::_setInstance方法的具体用法?PHP Am_Di::_setInstance怎么用?PHP Am_Di::_setInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Di
的用法示例。
在下文中一共展示了Am_Di::_setInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: bootstrap
public function bootstrap()
{
if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'debug') {
error_reporting(E_ALL | E_RECOVERABLE_ERROR | E_NOTICE | E_DEPRECATED | E_STRICT);
@ini_set('display_errors', true);
} else {
error_reporting(error_reporting() & ~E_RECOVERABLE_ERROR);
// that is really annoying
}
spl_autoload_register(array(__CLASS__, '__autoload'));
$this->di = new Am_Di($this->config);
Am_Di::_setInstance($this->di);
$this->di->app = $this;
set_error_handler(array($this, '__error'));
set_exception_handler(array($this, '__exception'));
$this->di->init();
try {
$this->di->getService('db');
} catch (Am_Exception $e) {
if (defined('AM_DEBUG') && AM_DEBUG) {
amDie($e->getMessage());
} else {
amDie($e->getPublicError());
}
}
$this->di->config;
// this will reset timezone to UTC if nothing configured in PHP
date_default_timezone_set(@date_default_timezone_get());
$this->initConstants();
// set memory limit
$limit = @ini_get('memory_limit');
if (preg_match('/(\\d+)M$/', $limit, $regs) && $regs[1] <= 64) {
@ini_set('memory_limit', '64M');
}
//
$this->initModules();
$this->initSession();
Am_Locale::initLocale($this->di);
$this->initTranslate();
$this->initFront();
require_once 'Am/License.php';
// Load user in order to check may be we need to refresh user's session;
$this->di->auth->getUser();
$this->di->hook->call(Am_Event::INIT_FINISHED);
$this->bindUploadsIfNecessary();
$this->initFinished = true;
if (file_exists(APPLICATION_PATH . "/configs/site.php")) {
require_once APPLICATION_PATH . "/configs/site.php";
}
}
示例2: bootstrap
public function bootstrap()
{
if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'debug') {
error_reporting(E_ALL | E_RECOVERABLE_ERROR | E_NOTICE | E_DEPRECATED | E_STRICT);
@ini_set('display_errors', true);
} else {
error_reporting(error_reporting() & ~E_RECOVERABLE_ERROR);
// that is really annoying
}
spl_autoload_register(array(__CLASS__, '__autoload'));
$this->di = new Am_Di($this->config);
Am_Di::_setInstance($this->di);
$this->di->app = $this;
set_error_handler(array($this, '__error'));
set_exception_handler(array($this, '__exception'));
$this->di->init();
try {
$this->di->getService('db');
} catch (Am_Exception $e) {
if (defined('AM_DEBUG') && AM_DEBUG) {
amDie($e->getMessage());
} else {
amDie($e->getPublicError());
}
}
$this->di->config;
$this->initConstants();
// set memory limit
$limit = @ini_get('memory_limit');
if (preg_match('/(\\d+)M$/', $limit, $regs) && $regs[1] <= 32) {
@ini_set('memory_limit', '32M');
}
//
$this->initFront();
require_once 'Am/License.php';
$this->initModules();
/** @todo 4.2.0 move after initTranlate !! alex */
$this->initSession();
Am_Locale::initLocale($this->di);
$this->initTranslate();
$this->di->blocks->addDefaultBlocks();
$this->di->hook->call(Am_Event::INIT_FINISHED);
if (file_exists(APPLICATION_PATH . "/configs/site.php")) {
require_once APPLICATION_PATH . "/configs/site.php";
}
}