Statement on glibc/iconv Vulnerability

stream_context_set_options

(PHP 8 >= 8.3.0)

stream_context_set_optionsSets options on the specified context

Beschreibung

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

Sets options on the specified context.

Parameter-Liste

context

The stream or context resource to apply the options to.

options

The options to set for context.

Hinweis:

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.

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

Beispiel #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));
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

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

Siehe auch

add a note

User Contributed Notes

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