PHP - Funktion stream_copy_to stream()
Beispiel
Kopieren Sie 1024 Byte Daten von einem Stream in einen anderen:
<?php
$src = fopen("test1.txt", "r");
$dest = fopen("test2.txt", "w");
//
Copy 1024 bytes to test2.txt
echo stream_copy_to_stream($src, $dest, 1024)
. " bytes copied to test2.txt";
?>
Definition und Verwendung
Die Funktion stream_copy_to_stream() kopiert Daten von einem Stream in einen anderen.
Syntax
stream_copy_to_stream(src, dest, maxlength, offset)
Parameterwerte
Parameter | Description |
---|---|
src | Required. Specifies the source stream to copy data from |
dest | Required. Specifies the destination stream to copy data to |
maxlength | Optional. Specifies the maximum bytes to copy |
offset | Optional. Specifies the offset where to start to copy data |
Technische Details
Rückgabewert: | Die Gesamtzahl der kopierten Bytes. FALSE bei Fehler |
---|---|
PHP-Version: | 5.0+ |
PHP-Änderungsprotokoll: | PHP 5.1: Offset- Parameter hinzugefügt |
❮ PHP-Stream-Referenz