当前位置: 首页>>代码示例>>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;未经允许,请勿转载。