本文整理汇总了PHP中KAutoloader::_classMap方法的典型用法代码示例。如果您正苦于以下问题:PHP KAutoloader::_classMap方法的具体用法?PHP KAutoloader::_classMap怎么用?PHP KAutoloader::_classMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAutoloader
的用法示例。
在下文中一共展示了KAutoloader::_classMap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadClassMapFromCache
public static function loadClassMapFromCache()
{
if (self::$_classMap) {
return true;
}
if (!file_exists(self::$_classMapFileLocation)) {
return false;
}
// if cached map was not loaded but exists on the disk, load it
self::$_classMap = unserialize(file_get_contents(self::$_classMapFileLocation));
if (!is_array(self::$_classMap)) {
$permission = substr(decoct(fileperms(self::$_classMapFileLocation)), 2);
error_log("PHP Class map could not be loaded from path [" . self::$_classMapFileLocation . "] file permissions [{$permission}]");
die('PHP Class map could not be loaded');
}
return true;
}
示例2: loadClassMap
/**
* Load and cache the class map
*/
private static function loadClassMap()
{
if (!self::$_classMapFileLocation || !file_exists(self::$_classMapFileLocation) || self::$_noCache == true) {
// cached map doesn't exists, rebuild the cache map
foreach (self::$_classPath as $dir) {
if (strpos($dir, DIRECTORY_SEPARATOR . "*") == strlen($dir) - 2) {
$dir = substr($dir, 0, strlen($dir) - 2);
$recursive = true;
} else {
$recursive = false;
}
self::scanDirectory($dir, $recursive);
}
if (self::$_noCache === false && self::$_classMapFileLocation) {
// save the cached map
$bytesWritten = file_put_contents(self::$_classMapFileLocation, serialize(self::$_classMap));
if (!$bytesWritten) {
$folderPermission = substr(decoct(fileperms(dirname(self::$_classMapFileLocation))), 2);
error_log("PHP Class map could not be saved to path [" . self::$_classMapFileLocation . "] folder permisisons [{$folderPermission}]");
die("PHP Class map could not be saved");
}
}
} else {
if (count(self::$_classMap) == 0) {
// if cached map was not loaded but exists on the disk, load it
self::$_classMap = unserialize(file_get_contents(self::$_classMapFileLocation));
if (!is_array(self::$_classMap)) {
$permission = substr(decoct(fileperms(self::$_classMapFileLocation)), 2);
error_log("PHP Class map could not be loaded from path [" . self::$_classMapFileLocation . "] file permisisons [{$permission}]");
die('PHP Class map could not be loaded');
}
}
}
}
示例3: loadClassMap
/**
* Load and cache the class map
*/
private static function loadClassMap()
{
if (!file_exists(self::$_classMapFileLocation) || self::$_noCache == true) {
// cached map doesn't exists, rebuild the cache map
foreach (self::$_classPath as $dir) {
if (strpos($dir, DIRECTORY_SEPARATOR . "*") == strlen($dir) - 2) {
$dir = substr($dir, 0, strlen($dir) - 2);
$recursive = true;
} else {
$recursive = false;
}
self::scanDirectory($dir, $recursive);
}
if (self::$_noCache === false) {
// save the cached map
file_put_contents(self::$_classMapFileLocation, serialize(self::$_classMap));
}
} else {
if (count(self::$_classMap) == 0) {
// if cached map was not loaded but exists on the disk, load it
self::$_classMap = unserialize(file_get_contents(self::$_classMapFileLocation));
}
}
}