php教程

Stream Contexts

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.

User Contributed Notes

alvaro at demogracia dot com 13-Jul-2015 12:19
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.

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788