stream_get_wrappers
(PHP 5, PHP 7, PHP 8)
stream_get_wrappers — 获取已注册的流类型
参数
此函数没有参数。
返回值
返回一个索引数组,该数组里包含了当前运行系统中可使用的流类型的名称。
示例
示例 #1 stream_get_wrappers() 例子
<?php
print_r(stream_get_wrappers());
?>
以上示例的输出类似于:
Array ( [0] => php [1] => file [2] => http [3] => ftp [4] => compress.bzip2 [5] => compress.zlib )
示例 #2 检查一个流类型是否存在
<?php
// 检查是否存在 bzip2 流包装器
if (in_array('compress.bzip2', stream_get_wrappers())) {
echo 'compress.bzip2:// support enabled.';
} else {
echo 'compress.bzip2:// support not enabled.';
}
?>
参见
- stream_wrapper_register() - 注册一个用 PHP 类实现的 URL 封装协议
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/function.stream-get-wrappers.php