spl_autoload_register()怎样注册多个自动加载函数?
<?php /*function __autoload($class){ require("./class/".$class.".php"); }*/ function auto($class){ require("./class/".$class.".php"); } function aa($class){ require("./class2/".$class.".php"); } spl_autoload_register("auto"); spl_autoload_register("aa"); $cc=spl_autoload_functions(); var_dump($cc); $a=new c(); $a->index(); ?>
输出:
SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。array(2) { [0]=> string(4) "auto" [1]=> string(2) "aa" } Warning: require(./class/c.php): failed to open stream: No such file or directory in D:\www\a\auto.php on line 8 Fatal error: require(): Failed opening required './class/c.php' (include_path='.;C:\php\pear') in D:\www\a\auto.php on line 8

更多精彩