php调用系统命令执行批处理文件
<?php
header("Content-Type: text/html; charset=gb2312");
function my_exec($cmd, $input="")
{
$proc=proc_open($cmd, array(0=>array("pipe", "r"),
1=>array("pipe", "w"),
2=>array("pipe", "w")),
$pipes);
fwrite($pipes[0], $input); fclose($pipes[0]);
$stdout=stream_get_contents($pipes[1]); fclose($pipes[1]);
$stderr=stream_get_contents($pipes[2]); fclose($pipes[2]);
$rtn=proc_close($proc); return array( "stdout"=>$stdout,
"stderr"=>$stderr,
"return"=>$rtn );
}
$need_run_file = __DIR__."..1make.bat";
$need_run_file = "D:xampphtdocswu1make.bat";
var_export(my_exec($need_run_file));
?>
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: php左侧分类列表显示菜单