<?php
if(isset($_POST['sub'])){
exec("mkdir ~/Desktop/pppp",$out);
//exec($_POST['cmd'],$out,$var);
//system("ping 127.0.0.1 -t");
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<table>
<form method="post" action="">
<tr>
<td>
<input type="txt" name="cmd" value="<?php echo $_POST['cmd']?>"/>
</td>
<td>
<input type="submit" name="sub" value="run" />
</td>
</tr>
</form>
</table>
<input type="text" name="result" value="<?php echo $out ?>" />
</body>
</html>
ubuntu环境,php配置正常,本意想要在html的text框中输入cmd命令行然后点击按钮执行,但无法执行,“out”返回的一直是字符串“Array”,而返回值是1.
光写上面那段php然后在终端中执行php命令可以正常执行。
如何解决?