include.php 1.3 KB

1234567891011121314151617181920212223242526272829
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | WeChatDeveloper
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: https://thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // | 免责声明 ( https://thinkadmin.top/disclaimer )
  11. // +----------------------------------------------------------------------
  12. // | gitee 代码仓库:https://gitee.com/zoujingli/WeChatDeveloper
  13. // | github 代码仓库:https://github.com/zoujingli/WeChatDeveloper
  14. // +----------------------------------------------------------------------
  15. spl_autoload_register(function ($classname) {
  16. $pathname = __DIR__ . DIRECTORY_SEPARATOR;
  17. $filename = str_replace('\\', DIRECTORY_SEPARATOR, $classname) . '.php';
  18. if (file_exists($pathname . $filename)) {
  19. foreach (['AliPay', 'WeChat', 'WeMini', 'WePay', 'We'] as $prefix) {
  20. if (stripos($classname, $prefix) === 0) {
  21. include $pathname . $filename;
  22. return true;
  23. }
  24. }
  25. }
  26. return false;
  27. });