array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.spl-autoload.php', 1 => 'spl_autoload', ), 'up' => array ( 0 => 'ref.spl.php', 1 => 'SPL 函数', ), 'prev' => array ( 0 => 'function.spl-autoload-unregister.php', 1 => 'spl_autoload_unregister', ), 'next' => array ( 0 => 'function.spl-classes.php', 1 => 'spl_classes', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/spl/functions/spl-autoload.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.1.0, PHP 7, PHP 8)
spl_autoload — __autoload()函数的默认实现
本函数用于 __autoload() 的默认实现。如果未指定任何参数调用 spl_autoload_register(),则此函数在 __autoload() 调用时会自动使用此函数。
class
已实例化的类(和命名空间)的名字。
file_extensions
在默认情况下,本函数先将类名转换成小写,再在小写的类名后加上 .inc 或 .php 的扩展名作为文件名,然后在所有的包含路径(include paths)中检查是否存在该文件。
没有返回值。
当未找到类或者没有注册其它自动加载器时抛出 LogicException。
版本 | 说明 |
---|---|
8.0.0 |
file_extensions 现在允许为 null。
|