©
Ce document utilise Manuel du site Web PHP chinois Libérer
A context is a set of parameters and wrapper specific options which modify or enhance the behavior of a stream. Contexts are created using stream_context_create() and can be passed to most filesystem related stream creation functions (i.e. fopen() , file() , file_get_contents() , etc...).
Options can be specified when calling stream_context_create() , or later using stream_context_set_option() . A list of wrapper specific options can be found in the 上下文(Context)选项和参数 chapter.
Parameters can be specified for contexts using the stream_context_set_params() function.
[#1] alvaro at demogracia dot com [2015-07-13 12:19:57]
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.