123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- error_reporting(-1);
- function psr0_autoload($className) {
- $className = ltrim($className, '\\');
- $fileName = '';
- $namespace = '';
- if ($lastNsPos = strripos($className, '\\')) {
- $namespace = substr($className, 0, $lastNsPos);
- $className = substr($className, $lastNsPos + 1);
- $fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
- }
- $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
-
- $sts = @include $fileName;
- return $sts;
- }
- function autoload_except($name) {
- $src = <<<EOT
- class $name {
- public function __construct() {
- throw new InvalidArgumentException("$name could not be found.");
- }
- public static function __callStatic(\$method_name, \$arguments) {
- throw new InvalidArgumentException("$name could not be found.");
- }
- }
- EOT;
- eval($src);
- }
|