Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1548596
  • 博文数量: 194
  • 博客积分: 6450
  • 博客等级: 准将
  • 技术积分: 2085
  • 用 户 组: 普通用户
  • 注册时间: 2005-06-06 13:39
文章分类

全部博文(194)

文章存档

2013年(38)

2012年(11)

2011年(1)

2010年(1)

2009年(4)

2008年(13)

2007年(18)

2006年(63)

2005年(45)

我的朋友

分类:

2005-12-21 10:14:54

参考手册,执行一个命令打开input/output文件指针。

$descriptorspec = array(
   0 => array("pipe", "r"),  // stdin is a pipe that the child will read from
   1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
   2 => array("file", "c: emperror-output.txt", "a") // stderr is a file to write to
);

$cwd = 'c:php';
$env = array('name' => 'liuyiwei');

$process = proc_open('php.exe', $descriptorspec, $pipes, $cwd, $env);

if (is_resource($process)) {
    // $pipes now looks like this:
    // 0 => writeable handle connected to child stdin
    // 1 => readable handle connected to child stdout
    // Any error output will be appended to /tmp/error-output.txt

    fwrite($pipes[0], '".$name; ?>');
    fclose($pipes[0]);

    //echo stream_get_contents($pipes[1]);
    //fclose($pipes[1]);
    echo "

";
    print_r(proc_get_status($process));
    echo "
";
    // It is important that you close any pipes before calling
    // proc_close in order to avoid a deadlock
    //$return_value = proc_close($process);

    //echo "
command returned $return_value ";
}

?>
阅读(3212) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~