导航首页 » 技术教程 » PHP:stream_get_wrappers()的用法_Stream函数
PHP:stream_get_wrappers()的用法_Stream函数 194 2023-12-15   

stream_get_wrappers

(PHP 5)

stream_get_wrappers — 获取已注册的流类型

说明

array stream_get_wrappers ( void )

获取在当前运行系统中已经注册并可使用的流类型列表。

返回值

返回一个索引数组,该数组里包含了当前运行系统中可使用的流类型的名称。

范例

Example #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
)

Example #2 检查一个流类型是否存在

<?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()

!!!站长长期在线接!!!

网站、小程序:定制开发/二次开发/仿制开发等

各种疑难杂症解决/定制接口/定制采集等

站长微信:lxwl520520

站长QQ:1737366103