stream_context_set_option

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

stream_context_set_option對(duì)資源流、數(shù)據(jù)包或者上下文設(shè)置參數(shù)

說明

stream_context_set_option(
    resource $stream_or_context,
    string $wrapper,
    string $option,
    mixed $value
): bool
stream_context_set_option(resource $stream_or_context, array $options): bool

給指定的上下文設(shè)置參數(shù)。參數(shù) value 是設(shè)置 wrapperoption 參數(shù)的值。

參數(shù)

stream_or_context

需要添加參數(shù)的資源流或者上下文。

wrapper

封裝協(xié)議的名稱(可能與協(xié)議不同)。 請(qǐng)參考 上下文(Context)選項(xiàng)和參數(shù) 查看資源流參數(shù)列表。

option

選項(xiàng)的名稱。

value

選項(xiàng)的值。

options

stream_or_context 設(shè)置的選項(xiàng)。

注意:

options 必須是一個(gè) $arr['wrapper']['option'] = $value 格式二維關(guān)聯(lián)數(shù)組 。

請(qǐng)參考 上下文(Context)選項(xiàng)和參數(shù) 查看資源流參數(shù)列表。

返回值

成功時(shí)返回 true, 或者在失敗時(shí)返回 false。