ext-uv/examples/fs.php

26 lines
454 B
PHP
Raw Normal View History

2012-06-22 01:20:22 +02:00
<?php
function r($rs,$data)
{
global $buf;
global $x;
$buf .= $data;
if ($rs != 0) {
echo "moe";
uv_fs_read(uv_default_loop(),$x,"r");
} else {
var_dump($buf);
2012-06-22 05:13:11 +02:00
uv_fs_close(uv_default_loop(), $x,function(){
echo "# closed\n";
});
2012-06-22 01:20:22 +02:00
}
}
uv_fs_open(uv_default_loop(),"./fs.php", 0, 0, function($r){
global $x;
$x = $r;
uv_fs_read(uv_default_loop(),$r,"r");
});
uv_run();