FOF30\Utils\Buffer::stream_open PHP Méthode

stream_open() public méthode

Function to open file or url
See also: streamWrapper::stream_open
public stream_open ( string $path, string $mode, integer $options, &$opened_path ) : boolean
$path string The URL that was passed
$mode string Mode used to open the file @see fopen
$options integer Flags used by the API, may be STREAM_USE_PATH and STREAM_REPORT_ERRORS
Résultat boolean
    public function stream_open($path, $mode, $options, &$opened_path)
    {
        $url = parse_url($path);
        $this->name = $url['host'];
        $this->position = 0;
        if (!isset(static::$buffers[$this->name])) {
            static::$buffers[$this->name] = null;
        }
        return true;
    }

Usage Example

Exemple #1
0
 /**
  * @return Buffer
  */
 protected function buildBuffer()
 {
     $buffer = new Buffer();
     $dummy = null;
     $buffer->stream_open('buffer://path/to/some/file', 'w', null, $dummy);
     return $buffer;
 }