stream_get_wrappers()
(PHP 5, PHP 7)
获取已注册的流类型
说明
stream_get_wrappers(void): array
获取在当前运行系统中已经注册并可使用的流类型列表。
返回值
返回一个索引数组,该数组里包含了当前运行系统中可使用的流类型的名称。
范例
Example #1stream_get_wrappers()例子
<?php print_r(stream_get_wrappers()); ?>
以上例程的输出类似于:
Array ( [0] => php [1] => file [2] => http [3] => ftp [4] => compress.bzip2 [5] => compress.zlib )
检查一个流类型是否存在
<?php // check for the existence of the bzip2 stream wrapper 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 封装协议