array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.stream-context-set-options.php', 1 => 'stream_context_set_options', 2 => 'Sets options on the specified context', ), 'up' => array ( 0 => 'ref.stream.php', 1 => 'Akım İşlevleri', ), 'prev' => array ( 0 => 'function.stream-context-set-option.php', 1 => 'stream_context_set_option', ), 'next' => array ( 0 => 'function.stream-context-set-params.php', 1 => 'stream_context_set_params', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/stream/functions/stream-context-set-options.xml', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

stream_context_set_options

(PHP 8 >= 8.3.0)

stream_context_set_optionsSets options on the specified context

Açıklama

stream_context_set_options(resource $context, array $options): true

Sets options on the specified context.

Bağımsız Değişkenler

context

The stream or context resource to apply the options to.

options

The options to set for context.

Bilginize:

options must be an associative array of associative arrays in the format $array['wrapper']['option'] = $value.

Refer to context options and parameters for a listing of stream options.

Dönen Değerler

Başarı durumunda true, başarısızlık durumunda false döner.

Örnekler

Örnek 1 stream_context_set_options() example

<?php

$context
= stream_context_create();

$options = [
'http' => [
'protocol_version' => 1.1,
'user_agent' => 'PHPT Agent',
],
];

stream_context_set_options($context, $options);
var_dump(stream_context_get_options($context));
?>

Yukarıdaki örneğin çıktısı:

array(1) {
  ["http"]=>
  array(2) {
    ["protocol_version"]=>
    float(1.1)
    ["user_agent"]=>
    string(10) "PHPT Agent"
  }
}

Ayrıca Bakınız