« stream_context_get_default
stream_context_get_params »

stream_context_get_options

(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)

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

説明

function stream_context_get_options(resource $stream_or_context): array

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

パラメータ

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"
  }
}

関連キーワード:
stream   context   ストリーム   コンテキスト   options   ラッパー   default   params   method   http   resource   連想   dump
関連する関数・ページ:
function.stream-context-create   function.stream-context-set-options   function.stream-context-set-default   function.stream-context-get-params   function.stream-context-set-option   function.stream-context-set-params