1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| ob_implicit_flush();
$file_size = 0;
apc_store('foo34567', 2);
function stream_notification_callback($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) {
echo $bytes_max."<br>";
$array = array (
'total' => $bytes_max,
'current' => $bytes_transferred
);
apc_cas('foo34567', apc_fetch('foo34567'), $bytes_transferred);
}
$ctx = stream_context_create();
stream_context_set_params($ctx, array("notification" => "stream_notification_callback"));
$url = 'http://windows.php.net/downloads/releases/php-5.3.8-src.zip';
$source = fopen($url, 'rb', false, $ctx);
$dest = fopen(basename($url), 'wb');
stream_copy_to_stream($source, $dest);
fclose($source);
fclose($dest); |
Partager