function execute($cmd) {
$res =
if ($cmd) {
if(function_exists(
@ob_start();
@system($cmd);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(function_exists(
@ob_start();
@passthru($cmd);
$res = @ob_get_contents();
@ob_end_clean();
} elseif(function_exists(
$res = @shell_exec($cmd);
} elseif(function_exists(
@exec($cmd
$res = join(“n"
} elseif(@is_resource($f = @popen($cmd
$res =
while(!@feof($f)) {
$res
}
@pclose($f);
}
}
return $res;
}
From:http://tw.wingwit.com/Article/program/PHP/201311/20961.html