(PHP 5 >= 5.1.0, PHP 7, PHP 8)
spl_autoload_extensions — 注册并返回 spl_autoload 的默认文件扩展名
$file_extensions
= null
): string本函数可以修改和检查 __autoload() 后备函数 spl_autoload() 将使用的扩展名。
Note: 在定义的文件扩展名之间不应该有空格。
file_extensions
如果为 null
,只返回当前扩展名列表,每个扩展名用逗号分隔。要修改文件扩展名列表,只需在单个字符串中,用逗号分割的新文件扩展名列表调用此函数即可。
逗号分隔的 spl_autoload() 的默认文件扩展名。
版本 | 说明 |
---|---|
8.0.0 |
file_extensions 现在可以为 null。
|
Example #1 spl_autoload_extensions() 示例
<?php
spl_autoload_extensions(".php,.inc");
?>