关于proc_open调用cmd的问题

sunzhou96 2017-04-26 04:58:03
<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);

}
?>

请问我哪里写的有问题?
运行结果如下
...全文
175 回复 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

21,893

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧