企业🤖AI Agent构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] ## 概述 可同时注册多个 ## 实例 <details> <summary>bar/bar1/A.php</summary> ``` <?php namespace bar\bar1; class A{ public function echo(){ echo "a"; } } function func_echo(){ echo 'func_echo'; } ``` </details> <br/> <details> <summary>src/index.php</summary> ``` <?php /** * @param string $class \bar\bar1\A */ function auto_register($class){ $include_path=__DIR__.'/../'.str_replace('\\','/',$class).'.php'; include_once $include_path; } spl_autoload_register('auto_register'); $a = new \bar\bar1\A(); $a->echo(); // a // 自动导入函数 \bar\bar1\func_echo(); ``` </details> <br/>