예제 #1
0
파일: pipe.php 프로젝트: zhanglei/php-uv
<?php

$pipe = uv_pipe_init(uv_default_loop(), 0);
uv_pipe_open($pipe, 1);
//uv_pipe_bind($pipe,"/tmp/hoge.sock");
uv_write($pipe, "Hello", function ($b, $s) {
    echo 1;
    uv_close($b);
});
uv_run();
예제 #2
0
<?php

$in = uv_pipe_init(uv_default_loop(), true);
echo "HELLO ";
$stdio = array();
$stdio[] = uv_stdio_new($in, UV::CREATE_PIPE | UV::READABLE_PIPE);
$fp = fopen("php://stdout", "w");
$stdio[] = uv_stdio_new($fp, UV::INHERIT_FD | UV::WRITABLE_PIPE);
$flags = 0;
uv_spawn(uv_default_loop(), "php", array('-r', 'var_dump($_ENV);'), $stdio, "/usr/bin/", array("key" => "hello"), function ($process, $stat, $signal) {
    uv_close($process, function () {
    });
}, $flags);
uv_run();