diff --git a/include.php b/include.php index 06fd3b2..e88c70e 100644 --- a/include.php +++ b/include.php @@ -13,13 +13,15 @@ // +---------------------------------------------------------------------- spl_autoload_register(function ($classname) { - $filename = __DIR__ . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php'; - if (file_exists($filename)) { - if (stripos($classname, 'WeChat') === 0) include $filename; - elseif (stripos($classname, 'WeMini') === 0) include $filename; - elseif (stripos($classname, 'AliPay') === 0) include $filename; - elseif (stripos($classname, 'WePay') === 0) include $filename; - elseif ($classname === 'We') include $filename; + $pathname = __DIR__ . DIRECTORY_SEPARATOR; + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php'; + if (file_exists($pathname . $filename)) { + foreach (['WeChat', 'WeMini', 'AliPay', 'WePay', 'We'] as $prefix) { + if (stripos($classname, $prefix) === 0) { + include $pathname . $filename; + return true; + } + } } return false; }); \ No newline at end of file