不知道你这里的exec是不是php里面的还是系统bash内置的。
如果是php的
这是语法
string exec ( string $command [, array &$output [, int &$return_var ]] )
command
The command that will be executed.
output
If the output argument is present, then the specified array will be filled with every line of output from the command. Trailing whitespace, such as \n, is not included in this array. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().
return_var
If the return_var argument is present along with the output argument, then the return status of the executed command will be written to this variable.
Return Values
The last line from the result of the command. If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function.
To get the output of the executed command, be sure to set and use the output parameter.
意思就是说输出和返回 都是可选参数,你要指定了才有!!
具体的你查看一下php手册,一贴网址就不显示了
追问手册我查了,后面两个参数不论是指定还是直接把写成$a=exec(....);的行使,都没有内容输出,而且最后的参数表示命令的执行情况,我这的返回值是127,表示什么意思,我不是很清楚。
追答我个人觉得都看不懂你的代码?你写成这样试试,我认为你的command有问题才会得到127
本回答被提问者采纳