展会信息港展会大全

PHP系统命令函数使用分析 android软件开发教程
来源:互联网   发布日期:2016-03-02 15:18:25   浏览:1241次  

导读:本篇文章是对PHP中系统命令函数的使用进行了详细的分析介绍,需要的朋友参考下复制代码 代码如下:function execute($cmd) { $res = ...

本篇文章是对PHP中系统命令函数的使用进行了详细的分析介绍,需要的朋友参考下

复制代码 代码如下:

function execute($cmd) {

$res = '';

if ($cmd) {

if(function_exists('system')) {

@ob_start();

@system($cmd);

$res = @ob_get_contents();

@ob_end_clean();

} elseif(function_exists('passthru')) {

@ob_start();

@passthru($cmd);

$res = @ob_get_contents();

@ob_end_clean();

} elseif(function_exists('shell_exec')) {

$res = @shell_exec($cmd);

} elseif(function_exists('exec')) {

@exec($cmd,$res);

$res = join(“n",$res);

} elseif(@is_resource($f = @popen($cmd,"r"))) {

$res = '';

while(!@feof($f)) {

$res .= @fread($f,1024);

}

@pclose($f);

}

}

return $res;

}

赞助本站

人工智能实验室

相关热词: 开发 编程 android

AiLab云推荐
展开

热门栏目HotCates

Copyright © 2010-2024 AiLab Team. 人工智能实验室 版权所有    关于我们 | 联系我们 | 广告服务 | 公司动态 | 免责声明 | 隐私条款 | 工作机会 | 展会港