-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Framework; | ||
|
||
|
||
class Loader | ||
{ | ||
|
||
/** | ||
* 注册自动加载类文件方法 | ||
*/ | ||
public static function registerAutoLoad() | ||
{ | ||
spl_autoload_register("\Framework\Loader::autoLoad"); | ||
} | ||
|
||
/** | ||
* 自动加载的目录 | ||
* @var array | ||
*/ | ||
private static $dirs = array(); | ||
|
||
public static function addAutoloadDIR($dir) | ||
{ | ||
self::$dirs[] = $dir; | ||
} | ||
|
||
/** | ||
* 自动加载类文件 | ||
* @param string $class | ||
*/ | ||
public static function autoLoad($class) | ||
{ | ||
$file = str_replace('\\', '/', $class) . ".php"; | ||
foreach (self::$dirs as $dir) { | ||
$tmp = $dir . "/" . $file; | ||
if (file_exists($tmp)) { | ||
return require_once $tmp; | ||
} | ||
} | ||
|
||
echo $class . ' not exist!'; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ "require":{ | ||
"ezyang/htmlpurifier": "^4.12", | ||
"swoole/ide-helper": "@dev" | ||
}} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters