PHP系統(tǒng)命令函數(shù)使用分析_PHP教程
推薦:WordPress禁止輸出錯誤信息設(shè)置方法用網(wǎng)站安全檢測掃瞄博客,發(fā)現(xiàn)了一個漏洞,實際上就是直接訪問主題路徑的話,get_header()函數(shù)未生效(Call to undefined function get_header() ),而我的WordPress會輸出完整的錯誤信息,將敏感名稱的目錄結(jié)構(gòu)暴露了,雖然對正常訪問沒有影響,可是會給某些人可乘之
本篇文章是對PHP中系統(tǒng)命令函數(shù)的使用進行了詳細的分析介紹,需要的朋友參考下 復制代碼 代碼如下:
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簡單縮略圖類|image.class.php使用方法: $img = new iamge; $img-resize('dstimg.jpg', 'srcimg.jpg', 300, 400); 說明:這個是按照比例縮放,dstimg.jpg是目標文件,srcimg.jpg是源文件,后面的是目標文件的寬和高 $img-thumb('dstimg.jpg', 'scrimg.jpg', 300, 300); 說明:這個是按照比例縮略圖
- 相關(guān)鏈接:
- 教程說明:
PHP教程-PHP系統(tǒng)命令函數(shù)使用分析
。