當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Tools::atknotice方法代碼示例

本文整理匯總了PHP中Sintattica\Atk\Core\Tools::atknotice方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tools::atknotice方法的具體用法?PHP Tools::atknotice怎麽用?PHP Tools::atknotice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sintattica\Atk\Core\Tools的用法示例。


在下文中一共展示了Tools::atknotice方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getInstance

 /**
  * Get Cache instance, default when no type
  * is configured it will use var cache.
  *
  * @param string $types Cache type
  * @param bool $fallback fallback to var cache if all types fail?
  * @param bool $force force new instance
  *
  * @return Cache object of the request type
  *
  * @throws Exception if $fallback is false and Cache type(s) not found
  */
 public static function getInstance($types = '', $fallback = true, $force = false)
 {
     if ($types == '') {
         $types = Config::getGlobal('cache_method', array());
     }
     if (!is_array($types)) {
         $types = array($types);
     }
     foreach ($types as $type) {
         try {
             if (!$force && array_key_exists($type, self::$m_instances) && is_object(self::$m_instances[$type])) {
                 Tools::atkdebug("cache::getInstance -> Using cached instance of {$type}");
                 return self::$m_instances[$type];
             } else {
                 self::$m_instances[$type] = new $type();
                 self::$m_instances[$type]->setNamespace(Config::getGlobal('cache_namespace', 'default'));
                 self::$m_instances[$type]->setLifetime(self::$m_instances[$type]->getCacheConfig('lifetime', 3600));
                 self::$m_instances[$type]->setActive(Config::getGlobal('cache_active', true));
                 Tools::atkdebug("cache::getInstance() -> Using {$type} cache");
                 return self::$m_instances[$type];
             }
         } catch (Exception $e) {
             Tools::atknotice("Can't instantatie atkCache class {$type}: " . $e->getMessage());
         }
     }
     if (!$fallback) {
         throw new Exception('Cannot instantiate Cache class of the following type(s): ' . implode(', ', $types));
     }
     // Default return var cache
     Tools::atkdebug('cache::getInstance() -> Using var cache');
     return self::getInstance('var', false, $force);
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:44,代碼來源:Cache.php

示例2: getQueryMode

 /**
  * Returns the query mode.
  *
  * @param string $query
  *
  * @return string Return r or w mode
  */
 public function getQueryMode($query)
 {
     $query = strtolower($query);
     $regexes = array('^\\s*select(?!\\s+into)', '^\\s*show');
     foreach ($regexes as $regex) {
         if (preg_match("/{$regex}/", $query)) {
             return 'r';
         }
     }
     Tools::atknotice('Query mode not detected! Using write mode.');
     return 'w';
 }
開發者ID:sintattica,項目名稱:atk,代碼行數:19,代碼來源:Db.php


注:本文中的Sintattica\Atk\Core\Tools::atknotice方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。