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


PHP Factory::load方法代碼示例

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


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

示例1: __construct

 public function __construct($config = array())
 {
     $this->db_config = array('driver' => 'sqlite', 'file' => STORAGE_PATH . 'sitesearch.sqlite', 'host' => 'localhost', 'db' => 'sitesearch_searchengine', 'user' => 'root', 'pass' => '');
     // apply config
     foreach ($config as $key => $value) {
         $this->{$key} = $value;
     }
     $this->db = Factory::load('Db:dbsitesearch', $this->db_config);
     $this->bm = Factory::load('Benchmark:benchmarksitesearch');
 }
開發者ID:rrosas,項目名稱:morrowtwo,代碼行數:10,代碼來源:Sitesearch.php

示例2: __construct

 public function __construct(array $config)
 {
     parent::__construct();
     $this['config'] = array_merge(array('mode' => 'production', 'encoding' => 'utf8', 'namespace' => ''), $config);
     $this['db'] = function ($c) {
         $db = new Database($c['config']['db']);
         $db->execute("SET NAMES '" . $c['config']['encoding'] . "';");
         return $db;
     };
     $this['query'] = $this->factory(function ($c) {
         return new Query($c);
     });
     if (isset($this['config']['tables']) && is_array($this['config']['tables'])) {
         $namespace = $this['config']['namespace'];
         if ($namespace) {
             $namespace .= '\\';
         }
         foreach ($this['config']['tables'] as $classname => $tablename) {
             $this[$classname] = function ($c) use($classname, $tablename, $namespace) {
                 return Factory::load($namespace . $classname, $c, $tablename);
             };
         }
     }
 }
開發者ID:voilab,項目名稱:acedao,代碼行數:24,代碼來源:Container.php

示例3: __get

 /**
  * Allows to access and instantiating a class by accessing an object member.
  * @param	string	$instance_identifier The instance identifier.
  * @return	object  Returns the created instance.
  */
 public function __get($instance_identifier)
 {
     $this->{$instance_identifier} = Factory::load(ucfirst($instance_identifier));
     return $this->{$instance_identifier};
 }
開發者ID:rrosas,項目名稱:morrowtwo,代碼行數:10,代碼來源:Factory.php

示例4: dump

 /**
  * Dumps any number of variables to the screen.
  * @param mixed $variable Pass a variable number of arguments to this method
  * @return null
  */
 public static function dump($variable)
 {
     $args = func_get_args();
     echo Factory::load('Debug')->_dump($args);
 }
開發者ID:rrosas,項目名稱:morrowtwo,代碼行數:10,代碼來源:Debug.php


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