/** * 执行系统命令 * * @param string $commandName 命令名 * @param string $args 参数 * @return bool */ function do_command($commandName, $args){ $buffer = ""; if(false === ($command = find_command($commandName))) return false; if($fp = @popen("$command $args",'r')){ while(!@feof($fp)){ $buffer .= @fgets($fp,4096); } return trim($buffer); } return false; }