Index des fonctions
<<<
Introduction Pré-requis
>>>

6.98 Stream functions
6 Index des fonctions
 Manuel PHP

->Introduction
Pré-requis
Installation
Configuration à l'exécution
Stream Classes
Constantes Prédefinies
Stream Errors
Exemples

6.98.1 Introduction

Streams were introduced with PHP 4.3.0 as a way of generalizing file, network, data compression, and other opperations which share a common set of functions and uses. In its simplest definition, a stream is a resource object which exhibits streamable behavior. That is, it can be read from or written to in a linear fashion, and may be able to fseek to an arbitrary locations within the stream.

A wrapper is additional code which tells the stream how to handle specific protocols/encodings. For example, the http wrapper knows how to translate a URL into an HTTP/1.1 request for a file on a remote server. There are many wrappers built into PHP by default (See Liste des protocoles supportés ), and additional, custom wrappers may be added either within a PHP script using stream_register_wrapper , or directly from an extension using the API Reference in API de flôts les auteurs d'extensions . Because any variety of wrapper may be added to PHP , there is no set limit on what can be done with them. To access the list of currently registered wrappers, use stream_get_wrappers .

A filter is a final piece of code which may perform opperations on data as it is being read from or written to a stream. Any number of filters may be stacked onto a stream. Custom filters can be defined in a PHP script using stream_register_filter or in an extension using the API Reference in API de flôts les auteurs d'extensions . To access the list of currently registered filters, use stream_get_filters .

A stream is referenced as: scheme :// target

  • scheme (string) - The name of the wrapper to be used. Examples include: file, http, https, ftp, ftps, compress.zlib, compress.bz2, ssl, tls, and php. See Liste des protocoles supportés for a list of PHP builtin wrappers. If no wrapper is specified, the function default is used (typically file ://).
  • target - Depends on the wrapper used. For filesystem related streams this is typically a path and filename of the desired file. For network related streams this is typically a hostname, often with a path appended. Again, see Liste des protocoles supportés for a description of targets for builtin streams.

<< Introduction >>
Index des fonctions Stream functions Pré-requis