PHP 8.3.4 Released!

Контексты потоков

Контекст - это набор параметров и зависящих от контекста опций, который изменяет или расширяет поведение потока. Контексты создаются при помощи функции stream_context_create() и могут быть переданы большинству функций файловой системы, связанных с созданием потоков (например, fopen(), file(), file_get_contents(), и т. д...).

Опции могут быть определены при вызове функции stream_context_create(), или позже, используя функцию stream_context_set_option(). Список возможных опций в данном контексте может быть найден в главе Контекстные опции и параметры.

Параметры могут быть определены для контекстов, используя функцию stream_context_set_params().

add a note

User Contributed Notes 1 note

up
2
alvaro at demogracia dot com
8 years ago
Two important terms:

- An *option* is a protocol-specific setting, e.g. "method" (get, post, put...) if you are using HTTP or "callback function to be called when inserting a document" in MongoDB.

- A *parameter* is a settings that's common to all protocols. As of 2015 only one parameter got implemented ("notification").

While these words might look vague they are used coherently throughout the stream feature, documentation included.
To Top