stream_copy_to_stream
(PHP 5)
stream_copy_to_stream -- データをあるストリームから別のストリームにコピーする
説明
int
stream_copy_to_stream ( resource source, resource dest [, int maxlength] )
source の現在の内部位置から、
最大 maxlength バイトのデータを、
dest にコピーします。
もし maxlength が指定されていない時は、
source にある残りのすべてのデータが
コピーされます。返値はコピーされたデータの総バイト数です。
例 1. stream_copy_to_stream() の例
<?php $src = fopen('http://www.example.com','r'); $dest1 = fopen('first1k.txt','w'); $dest2 = fopen('remainder.txt','w');
print stream_copy_to_stream($src, $dest1, 1024) . " バイトが first1k.txt にコピーされました\n"; print stream_copy_to_stream($src, $dest2) . " バイトが remainder.txt にコピーされました\n";
?>
|
|
copy() も参照ください。