本文整理匯總了PHP中AutoLoader::instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP AutoLoader::instance方法的具體用法?PHP AutoLoader::instance怎麽用?PHP AutoLoader::instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AutoLoader
的用法示例。
在下文中一共展示了AutoLoader::instance方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getInstance
/**
* Singleton - bekomme die laufen instanz vom objekt
*/
public static function getInstance()
{
if (null === self::$instance) {
self::$instance = new self();
}
return self::$instance;
}
示例2: createInstance
public static function createInstance()
{
if (self::$instance == NULL) {
self::$instance = new AutoLoader();
}
return self::$instance;
}
示例3: getInstance
public static function getInstance()
{
if (is_null(self::$instance)) {
self::$instance = new AutoLoader();
}
return self::$instance;
}
示例4: instance
/**
* Returns the instance of the AutoLoader Singleton or instantiates a new one
* @return AutoLoader
*/
public static function instance($rootDirectory = null, $reloadClassMap = true, $fileExt = null)
{
if (self::$instance == null) {
self::$instance = new AutoLoader($rootDirectory, $reloadClassMap, $fileExt);
}
return self::$instance;
}
示例5: testExpireCache
public function testExpireCache()
{
$cache = file_get_contents(AutoLoader::instance()->getCacheLocation());
$this->assertGreaterThan(0, strlen($cache));
AutoLoader::instance()->expireCache();
try {
if (!($cache = file_get_contents(AutoLoader::instance()->getCacheLocation()))) {
$this->assertTrue(true);
} else {
$this->assertTrue(false);
}
} catch (Exception $ex) {
$this->assertTrue(true);
}
}
示例6: die
<?php
/**
* Rebuilds the class mapping cache file for the auto_loader
* This can be done at run time but is real slow for big projects
* and definately doesn't want to be run in production so this
* should be run as part of deployment
* @example php ./rebuild_class_map.php
* @author Jason Paige
*/
if (php_sapi_name() != 'cli') {
die("This script can only be run on the command line.");
}
define("ROOT_PATH", __DIR__ . DIRECTORY_SEPARATOR . "..");
require_once ROOT_PATH . "/AutoLoader.php";
$autoLoader = AutoLoader::instance(ROOT_PATH, true);
$autoLoader->expireCache();
$autoLoader->ignore(ROOT_PATH . "ignore_folder")->ignore(ROOT_PATH . "ignore_folder2");
$autoLoader->init();
// correct the generated file paths
$classMap = file_get_contents($autoLoader->getCacheLocation());
if (!file_put_contents($autoLoader->getCacheLocation(), $classMap)) {
echo "Unable to write class map cache!";
exit(1);
} else {
echo "New class map cache generated at " . $autoLoader->getCacheLocation() . "\n";
exit;
}