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


PHP AutoLoader::instance方法代碼示例

本文整理匯總了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;
 }
開發者ID:pixelproduction,項目名稱:PixelManagerCMS,代碼行數:10,代碼來源:AutoLoader.php

示例2: createInstance

 public static function createInstance()
 {
     if (self::$instance == NULL) {
         self::$instance = new AutoLoader();
     }
     return self::$instance;
 }
開發者ID:vampirefrog,項目名稱:frogmod-justice,代碼行數:7,代碼來源:AutoLoader.php

示例3: getInstance

 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new AutoLoader();
     }
     return self::$instance;
 }
開發者ID:sigmadesarrollo,項目名稱:logisoft,代碼行數:7,代碼來源:AutoLoader.php

示例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;
 }
開發者ID:h1ppo,項目名稱:Class-Map-Autoloader-for-PHP,代碼行數:11,代碼來源:AutoLoader.php

示例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);
     }
 }
開發者ID:h1ppo,項目名稱:Class-Map-Autoloader-for-PHP,代碼行數:15,代碼來源:AutoLoaderTest.php

示例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;
}
開發者ID:h1ppo,項目名稱:Class-Map-Autoloader-for-PHP,代碼行數:28,代碼來源:rebuild-class-map-cache.php


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