xref: /php-uv/examples/fs.php (revision 99312394)
1<?php
2uv_fs_open(uv_default_loop(),__FILE__, UV::O_RDONLY, 0, function($r){
3    uv_fs_read(uv_default_loop(),$r,function($stream, $data) {
4        if (is_long($data)) {
5            if ($nread < 0) {
6                throw new Exception("read error");
7            }
8
9            uv_fs_close(uv_default_loop(), $stream, function(){
10            });
11        } else {
12            echo $data;
13        }
14    });
15});
16
17uv_run();
18