本文整理汇总了PHP中Ak::unsetStaticVar方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::unsetStaticVar方法的具体用法?PHP Ak::unsetStaticVar怎么用?PHP Ak::unsetStaticVar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::unsetStaticVar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
public function setup()
{
foreach (array_keys($this->_singletons) as $singleton) {
$this->_singletons[$singleton] = Ak::getStaticVar($singleton);
Ak::unsetStaticVar($singleton);
}
}
示例2: disconnect
public function disconnect()
{
if ($this->isConnected()) {
$this->getConnection()->close();
unset($this->_Mongo[$this->_connetion_signature]);
unset($this->_MongoDatabases[$this->_connetion_signature]);
Ak::unsetStaticVar(__CLASS__ . '_' . $this->_connetion_signature);
}
return !$this->isConnected();
}
示例3: dispatchAppServer
public function dispatchAppServer($context)
{
$_ENV = $_SERVER = $context['env'];
@parse_str($_ENV['QUERY_STRING'], $_GET);
$_GET['ak'] = $_ENV['PATH_INFO'];
Ak::unsetStaticVar('AkRequestSingleton');
Ak::unsetStaticVar('AkRouterSingleton');
Ak::unsetStaticVar('AkUrlWriterSingleton');
AkConfig::setOption('Request.remote_ip', '127.0.0.1');
try {
$time_start = microtime(true);
AK_ENABLE_PROFILER && AkDebug::profile(__CLASS__ . '::' . __FUNCTION__ . '() call');
$this->Request = AkRequest::getInstance();
$this->Response = new AkResponse();
$path = ltrim(str_replace('..', '.', $context['env']['REQUEST_URI']), '/. ');
if (empty($path) && file_exists(AK_PUBLIC_DIR . DS . 'index.html')) {
$Controller = new AkActionController();
$Controller->Response = $this->Response;
$Controller->renderText(file_get_contents(AK_PUBLIC_DIR . DS . 'index.html'));
return $Controller->Response;
} elseif (!empty($path) && file_exists(AK_PUBLIC_DIR . DS . $path)) {
$Controller = new AkActionController();
$Controller->Response = $this->Response;
$Controller->sendFile(AK_PUBLIC_DIR . DS . $path, array('stream' => false));
return $Controller->Response;
} else {
if ($this->Controller = $this->Request->recognize()) {
$this->Controller->ak_time_start = $time_start;
AK_ENABLE_PROFILER && AkDebug::profile('Request::recognize() completed');
$this->Controller->process($this->Request, $this->Response);
}
return $this->Response;
}
} catch (Exception $e) {
if (isset($this->Controller) && method_exists($this->Controller, 'render_error')) {
$this->Controller->render_error($e);
} else {
$ExceptionDispatcher = new AkExceptionDispatcher();
$ExceptionDispatcher->renderException($e);
}
}
}
示例4: isset
function &_staticVar($name, &$value, $destruct = false)
{
static $_memory;
$null = null;
$true = true;
$false = false;
$return = $null;
if ($value === null && $destruct === false) {
/**
* GET mode
*/
if (isset($_memory[$name])) {
$return =& $_memory[$name];
}
} else {
if ($value !== null) {
/**
* SET mode
*/
if (is_string($name)) {
$_memory[$name] =& $value;
$return = $true;
} else {
$return = $false;
}
} else {
if ($destruct === true) {
if ($name !== null) {
$value = isset($_memory[$name]) ? $_memory[$name] : $null;
if (is_object($value) && method_exists($value, '__destruct')) {
$value->__destruct();
}
unset($value);
unset($_memory[$name]);
} else {
foreach ($_memory as $name => $value) {
Ak::unsetStaticVar($name);
}
}
}
}
}
return $return;
}
示例5: clearStaticCache
public function clearStaticCache($namespace, $environment = TPV_MODE)
{
$key = $this->_getCacheKey($namespace, $environment);
Ak::unsetStaticVar($key);
}
示例6: test_static_var_destruct_all_vars
public function test_static_var_destruct_all_vars()
{
$value = new stdClass();
$value->id = 1;
$return = Ak::setStaticVar('testVar1', $value);
$this->assertEqual(true, $return);
$value2 = new stdClass();
$value2->id = 2;
$return = Ak::setStaticVar('testVar2', $value2);
$this->assertEqual(true, $return);
$value3 = new stdClass();
$value3->id = 3;
$return = Ak::setStaticVar('testVar3', $value3);
$this->assertEqual(true, $return);
$null = null;
Ak::unsetStaticVar('testVar1');
$storedValue1 =& Ak::getStaticVar('testVar1');
$this->assertEqual($null, $storedValue1);
$storedValue2 =& Ak::getStaticVar('testVar2');
$this->assertEqual($value2, $storedValue2);
$storedValue3 =& Ak::getStaticVar('testVar3');
$this->assertEqual($value3, $storedValue3);
Ak::unsetStaticVar($null);
$storedValue1 =& Ak::getStaticVar('testVar1');
$this->assertEqual($null, $storedValue1);
$storedValue2 =& Ak::getStaticVar('testVar2');
$this->assertEqual($null, $storedValue2);
$storedValue3 =& Ak::getStaticVar('testVar3');
$this->assertEqual($null, $storedValue3);
}
示例7: clearStaticCache
public function clearStaticCache($namespace, $environment = AK_ENVIRONMENT)
{
$key = $this->_getCacheKey($namespace, $environment);
Ak::unsetStaticVar($key);
}
示例8: isset
static function &_staticVar($name, &$value = null, $destruct = false)
{
static $_memory;
if (!constant('AK_CAN_FORK') || !($pid = getmypid())) {
$pid = 0;
}
$null = null;
$true = true;
$false = false;
$return = $null;
if ($value === null && $destruct === false) {
/**
* GET mode
*/
if (isset($_memory[$pid][$name])) {
$return = $_memory[$pid][$name];
}
} else {
if ($value !== null) {
/**
* SET mode
*/
if (is_string($name)) {
$_memory[$pid][$name] = $value;
$return = $true;
} else {
$return = $false;
}
} else {
if ($destruct === true) {
if ($name !== null) {
$value = isset($_memory[$pid][$name]) ? $_memory[$pid][$name] : $null;
if (is_object($value) && method_exists($value, '__destruct')) {
$value->__destruct();
}
unset($value);
unset($_memory[$pid][$name]);
} else {
foreach ($_memory[$pid] as $name => $value) {
Ak::unsetStaticVar($name);
}
}
}
}
}
return $return;
}