php 如何执行操作系统命令呢?
<?php
$type="1";//1-exec ; 2-system
if(!empty($_GET['type'])){
$type=$_GET['type'];
}
if(empty($_GET['cmd2'])){
echo "please input cmd";
exit();
}
$cmd2=$_GET['cmd2'];
echo $type."\n";
if($type=='1'){
exec($cmd2,$output);
print_r($output);
}else{
system($cmd2,$result);
print "exit code:".$result;//输出命令的结果状态码
}
?>
参考:https://www.douban.com/note/211492486/