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


PHP static::driver方法代碼示例

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


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

示例1: getFileSystem

 /**
  * 獲取Filesystem
  * @return Filesystem
  */
 public static function getFileSystem()
 {
     if (is_null(static::$driver)) {
         static::$driver = \Storage::drive('local');
     }
     return static::$driver;
 }
開發者ID:xjtuwangke,項目名稱:laravel-bundles,代碼行數:11,代碼來源:LocalStoredFile.php

示例2: setDriver

 public static function setDriver($new_driver)
 {
     $c = 'AeriaCache' . $new_driver;
     if (class_exists($c)) {
         static::$driver = $c;
     }
 }
開發者ID:caffeinalab,項目名稱:aeria,代碼行數:7,代碼來源:AeriaCache.php

示例3: factory

 /**
  * Factory method.
  *
  * @static
  * @access   public
  * @since    1.0.0-alpha
  * @version  1.0.0-alpha
  */
 public static function factory()
 {
     self::$defaultLifeTime = Config::get('cache.lifetime', 3600);
     $driverName = ucfirst(Config::get('cache.driver'));
     $driver = '\\Plethora\\Cache\\Drivers\\' . $driverName . 'CacheDriver';
     static::$driver = new $driver();
     Log::insert('Cache type "' . Config::get('cache.driver') . '" initialized!');
 }
開發者ID:ktrzos,項目名稱:plethora,代碼行數:16,代碼來源:Cache.php

示例4: init

 public static function init($driver = null)
 {
     if ($driver == null) {
         static::$driver = new DiskFileSystemDriver();
     } elseif ($driver instanceof LocalStorageDriverInterface) {
         static::$driver = $driver;
     } else {
         throw new Exception('driver must be instance of LocalStorageDriverInterface');
     }
 }
開發者ID:mordisacks,項目名稱:localstorage,代碼行數:10,代碼來源:LocalStorage.php

示例5: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     static::$driver = null;
     static::$pdo = null;
     foreach (static::$tempFiles as $file) {
         if (is_file($file)) {
             unlink($file);
         }
     }
     parent::tearDownAfterClass();
 }
開發者ID:phlib,項目名稱:flysystem-pdo,代碼行數:11,代碼來源:IntegrationTest.php

示例6: __construct

 /**
  * Constructor.
  *
  * @access  protected
  */
 protected function __construct()
 {
     // Set current time
     static::$now = time();
     // Cache key allows us to invalidate all cache on configuration changes.
     static::$key = (Config::get('system.cache.prefix') ? Config::get('system.cache.prefix') : 'fansoro') . '-' . md5(ROOT_DIR . Fansoro::VERSION);
     // Get Cache Driver
     static::$driver = static::getCacheDriver();
     // Set the cache namespace to our unique key
     static::$driver->setNamespace(static::$key);
 }
開發者ID:cv0,項目名稱:fansoro,代碼行數:16,代碼來源:Cache.php

示例7: using

 public static function using($driver, $options = null)
 {
     $class = 'Email\\' . ucfirst(strtolower($driver));
     if (!class_exists($class)) {
         throw new Exception("[core.email] : {$driver} driver not found.");
     }
     static::$driver_name = $driver;
     static::$options = $options;
     static::$driver = new $class();
     static::$driver->onInit($options);
 }
開發者ID:caffeina-core,項目名稱:core,代碼行數:11,代碼來源:Email.php

示例8: __construct

 /**
  * Create new session.
  *
  * @return void
  */
 public function __construct()
 {
     // Does the session need to be initialized?
     if (!static::$initialized) {
         // Get the driver name from the application config and get the
         // class name for us to instantiate.
         $driver = 'native';
         $class = 'Spire\\Session\\Driver\\' . ucfirst(strtolower($driver));
         // Instantiate driver.
         static::$driver = new $class();
         // Initialize the session.
         if (static::driver()->initialize()) {
             static::$initialized = true;
         }
     }
 }
開發者ID:spire-framework,項目名稱:spire,代碼行數:21,代碼來源:Session.php

示例9: init

 /**
  * Initialize both database and forge components
  */
 public static function init($driver)
 {
     if (empty(static::$db) && empty(static::$forge)) {
         $config = Mock_Database_DB::config($driver);
         $connection = new Mock_Database_DB($config);
         $db = Mock_Database_DB::DB($connection->set_dsn($driver), TRUE);
         CI_TestCase::instance()->ci_instance_var('db', $db);
         $loader = new CI_Loader();
         $loader->dbforge();
         $forge = CI_TestCase::instance()->ci_instance_var('dbforge');
         static::$db = $db;
         static::$forge = $forge;
         static::$driver = $driver;
     }
     return static::$db;
 }
開發者ID:DavBfr,項目名稱:BlogMVC,代碼行數:19,代碼來源:skeleton.php

示例10: _init

 /**
  * Init, config loading.
  * @throws Amon_Request_Exception
  */
 public static function _init()
 {
     \Config::load('amon', true);
     static::$config = \Config::get('amon');
     if (!class_exists('\\ZMQContext')) {
         static::$config['protocol'] = 'http';
     }
     $class = 'Amon_Request_' . ucwords(strtolower(static::$config['protocol']));
     if (!class_exists($class)) {
         throw new Amon_Request_Exception('Can not find request driver');
     }
     try {
         static::$driver = new $class(static::$config['host'], static::$config['port'], static::$config['application_key']);
     } catch (Amon_Request_Exception $e) {
         throw $e;
     }
 }
開發者ID:maca134,項目名稱:fuel-amon,代碼行數:21,代碼來源:request.php

示例11: using

 /**
  * Load cache drivers with a FCFS strategy
  *
  * @method using
  * @param  mixed $driver can be a single driver name string, an array of driver names or a map [ driver_name => driver_options array ]
  * @return bool   true if a driver was loaded
  * @example
  *
  *   Cache::using('redis');
  *   Cache::using(['redis','files','memory']); // Prefer "redis" over "files" over "memory" caching
  *   Cache::using([
  *         'redis' => [
  *             'host'   => '127.0.0.1',
  *             'prefix' => 'mycache',
  *          ],
  *         'files' => [
  *             'cache_dir' => '/tmp',
  *         ],
  *         'memory'
  *   ]);
  *
  */
 public static function using($driver)
 {
     foreach ((array) $driver as $key => $value) {
         if (is_numeric($key)) {
             $drv = $value;
             $conf = [];
         } else {
             $drv = $key;
             $conf = $value;
         }
         $class = 'Cache\\' . ucfirst(strtolower($drv));
         if (class_exists($class) && $class::valid()) {
             static::$driver = new $class($conf);
             return true;
         }
     }
     return false;
 }
開發者ID:caffeina-core,項目名稱:core,代碼行數:40,代碼來源:Cache.php

示例12: driver

 /**
  * Get the session driver.
  *
  * @return Session\Driver
  */
 public static function driver()
 {
     if (is_null(static::$driver)) {
         switch (Config::get('session.driver')) {
             case 'cookie':
                 return static::$driver = new Session\Cookie();
             case 'file':
                 return static::$driver = new Session\File();
             case 'db':
                 return static::$driver = new Session\DB();
             case 'memcached':
                 return static::$driver = new Session\Memcached();
             case 'apc':
                 return static::$driver = new Session\APC();
             default:
                 throw new \Exception("Session driver [{$driver}] is not supported.");
         }
     }
     return static::$driver;
 }
開發者ID:hpaul,項目名稱:Google-short,代碼行數:25,代碼來源:session.php

示例13: setDriver

 /**
  * Sets the database driver (string).
  */
 public static function setDriver($driver)
 {
     static::$driver = strtolower($driver);
 }
開發者ID:phpf,項目名稱:micro,代碼行數:7,代碼來源:Database.php

示例14: setDriver

 /**
  * @param ILogStore $d driver to be set
  */
 public static function setDriver(ILogStore $d)
 {
     static::$driver = $d;
 }
開發者ID:sophokli,項目名稱:HumanityEventLogger,代碼行數:7,代碼來源:EventLogger.php

示例15: _init

 public static function _init()
 {
     static::$driver = new \G2verify_Driver();
 }
開發者ID:ariela,項目名稱:fuel-g2verify,代碼行數:4,代碼來源:g2verify.php


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