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

Контекст — набор параметров и зависящих от обёртки опций, который изменяет или расширяет поведение потока. Контексты создаются функцией 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
6
alvaro at demogracia dot com
9 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