手机
当前位置:查字典教程网 >编程开发 >php教程 >PHP系统命令函数使用分析
PHP系统命令函数使用分析
摘要:复制代码代码如下:functionexecute($cmd){$res='';if($cmd){if(function_exists('sy...

复制代码 代码如下:

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;

}

【PHP系统命令函数使用分析】相关文章:

PHP网络操作函数汇总

php动态函数调用方法

PHP使用mysqldump命令导出数据库

PHP数组和explode函数示例总结

PHP中iconv函数知识汇总

PHP系统流量分析的程序

GD输出汉字的函数的分析

PHP中的traits简单使用实例

PHP中的魔术方法总结和使用实例

PHP date函数常用时间处理方法

精品推荐
分类导航