PHP stream_copy_to stream() Functie
Voorbeeld
Kopieer 1024 bytes aan gegevens van de ene stream naar de andere:
<?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";
?>
Definitie en gebruik
De functie stream_copy_to_stream() kopieert gegevens van de ene stream naar de andere.
Syntaxis
stream_copy_to_stream(src, dest, maxlength, offset)
Parameterwaarden
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
Winstwaarde: | Het totale aantal gekopieerde bytes. ONWAAR bij fout |
---|---|
PHP-versie: | 5.0+ |
PHP-wijzigingslogboek: | PHP 5.1: de offset- parameter toegevoegd |
❮ PHP Stream Referentie