|
stream_notification_callback
説明
void stream_notification_callback(
int $notification_code ,int $severity ,stringnull $message ,int $message_code ,int $bytes_transferred ,int $bytes_max ) イベント発生時にコールされる callable 関数です。 notification context parameter が使用します。
パラメータ
戻り値値を返しません。 例
例1 stream_notification_callback の例
<?php 上の例の出力は、 たとえば以下のようになります。 Connected... Found the mime-type: text/html; charset=utf-8 Being redirected to: http://no.php.net/contact Connected... Got the filesize: 0 Found the mime-type: text/html; charset=utf-8 Being redirected to: http://no.php.net/contact.php Connected... Got the filesize: 4589 Found the mime-type: text/html;charset=utf-8 Made some progress, downloaded 0 so far Made some progress, downloaded 0 so far Made some progress, downloaded 0 so far Made some progress, downloaded 1440 so far Made some progress, downloaded 2880 so far Made some progress, downloaded 4320 so far Made some progress, downloaded 5760 so far Made some progress, downloaded 6381 so far Made some progress, downloaded 7002 so far
例2 コマンドラインのダウンロードツール用のシンプルなプログレスバー
<?php
上の例を
Connected... Mime-type: text/html; charset=utf-8 Being redirected to: http://no2.php.net/distributions/php-5.2.5.tar.bz2 Connected... Filesize: 7773024 Mime-type: application/octet-stream [========================================> ] 40% (3076/7590 kb) |