PHP 8.3.4 Released!

stream_get_wrappers

(PHP 5, PHP 7, PHP 8)

stream_get_wrappers登録されているストリームのラッパーのリストを取得する

説明

stream_get_wrappers(): array

実行中のシステムで使用可能な、登録済みのストリームの一覧を取得します。

パラメータ

この関数にはパラメータはありません。

戻り値

スクリプトを走らせているシステム上で使うことのできるすべてのストリーム ラッパーの名前を配列の形で返します。

例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:// サポートが有効です。';
} else {
echo
'compress.bzip2:// サポートは有効ではありません。';
}
?>

参考

add a note

User Contributed Notes

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