本文整理汇总了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');
}
示例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);
};
}
}
}
示例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};
}
示例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);
}