<html>
<head>
<title>hello,the world</title>
</head>
<body>
<?php
header('Content-Type:text/html;charset=gbk');
$string='netstat\n';
$descriptorspec=array(
0=>array('pipe','r'),
1=>array('pipe','w'),
2=>array('file','error-output.txt','a')
);
$cwd='C:\windows\system32';
$process=proc_open('cmd.exe',$descriptorspec,$pipes,$cwd);
if (is_resource($process)) {
fwrite($pipes[0],substr($string,strlen($string)));
fclose($pipes[0]);
$output=stream_get_contents($pipes[1]);
fclose($pipes[1]);
echo $output;
echo '成功';
$value=proc_close($process);
}
?>
请问我哪里写的有问题?
运行结果如下
