Gold Vision Communications / USA
 GOLDVISION.COM
Serving the Multimedia Community since 1989.
German Site | Spanish Site 

 Web Hosting

 Virtual Dedicated Servers

 Domaincheck

 Order

 Order Status

 Support

 Contact us

 Download

 Network

 Network Status

 Webdesign / Templates

 Make Payment

 Terms & Conditions

 Imprint

 Legal Notices

 Privacy Statement
  PHP / file_register_wrapper
file_register_wrapper

file_register_wrapper

(PHP 4 CVS only)

file_register_wrapper -- Register a URL wrapper implemented as a PHP class

Beschreibung

boolean file_register_wrapper ( string protocol, string classname)

Diese Funktion ist derzeit nur anhand des folgenden Beispieles dokumentiert:

Beispiel 1. Implementieren eines base64 encoding Protokolls

class Base64EncodingStream {
    var $fp = null;

    function stream_open($path, $mode, $options, &$opened_path)
    {
        $this->fp = fopen($path, $mode);
        return is_resource($this->fp);
    }
    function stream_close()
    {
        fclose($this->fp);
    }
    function stream_read($count)
    {
        return false; // Wir erlauben nur schreiben
    }
    function stream_write($data)
    {
        return fwrite($this->fp, base64_encode($data));
    }
    function stream_flush()
    {
        fflush($this->fp);
        return true;
    }
    function stream_seek($offset, $whence)
    {
        return false;
    }
    function stream_gets()
    {
        return false;
    }
    function stream_tell()
    {
        return false;
    }
    function stream_eof()
    {
        return false;
    }
}
file_register_wrapper("base64", "Base64EncodingStream")
    or die("Failed to register protocol");

copy("/tmp/inputfile.txt", "base64:///tmp/outputfile.txt");
readfile("/tmp/outputfile");

file_register_wrapper() gibt FALSE zurück, falls protocol bereits einen Handler hat, oder wenn "fopen wrappers" deaktiviert sind.

Anmerkung: Diese Funktion wurde in PHP 4.3.0 eingeführt.


© 1998-2007 Gold Vision Communications All Rights Reserved.