stream_context_get_options

ストリーム / ラッパー / コンテキストに設定されているオプションを取得する

説明

array stream_context_get_options(resource $stream_or_context)

指定されたストリームまたはコンテキストに設定されたオプションを配列として返します。

パラメータ

stream_or_context

オプションを取得したいストリームあるいはコンテキスト。

戻り値

オプションを連想配列で返します。

例1 stream_context_get_options の例

<?php
$params 
= array("method" => "POST");

stream_context_set_default(array("http" => $params));

var_dump(stream_context_get_options(stream_context_get_default()));

?>

上の例の出力は、 たとえば以下のようになります。

array(1) {
  ["http"]=>
  array(1) {
    ["method"]=>
    string(4) "POST"
  }
}