spl_autoload_extensions

(PHP 5 >= 5.1.0, PHP 7, PHP 8)

spl_autoload_extensions注册并返回 spl_autoload 的默认文件扩展名

说明

spl_autoload_extensions(?string $file_extensions = null): string

本函数可以修改和检查 __autoload() 后备函数 spl_autoload() 将使用的扩展名。

注意: 在定义的文件扩展名之间不应该有空格。

参数

file_extensions

如果为 null,只返回当前扩展名列表,每个扩展名用逗号分隔。要修改文件扩展名列表,只需在单个字符串中,用逗号分割的新文件扩展名列表调用此函数即可。

返回值

逗号分隔的 spl_autoload() 的默认文件扩展名。

更新日志

版本 说明
8.0.0 file_extensions 现在可以为 null。

范例

示例 #1 spl_autoload_extensions() 示例

<?php
spl_autoload_extensions
(".php,.inc");
?>
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top