首頁  >  文章  >  後端開發  >  php调用com 组件wscript.shell执行dos命令_PHP教程

php调用com 组件wscript.shell执行dos命令_PHP教程

WBOY
WBOY原創
2016-07-20 11:06:321820瀏覽

/php调用com 组件wscript.shell执行dos命令
  p('


');<br>  if ($execfunc=='wscript' && IS_WIN && IS_COM) {<br>   $wsh = new COM('WScript.shell');<br>   $exec = $wsh->exec('cmd.exe /c '.$command);<br>   $stdout = $exec->StdOut();<br>   $stroutput = $stdout->ReadAll();<br>   echo $stroutput;<br>  } elseif ($execfunc=='proc_open' && IS_WIN && IS_COM) {<br>   $descriptorspec = array(<br>      0 => array('pipe', 'r'),<br>      1 => array('pipe', 'w'),<br>      2 => array('pipe', 'w')<br>   );<br>   $process = proc_open($_SERVER['COMSPEC'], $descriptorspec, $pipes);<br>   if (is_resource($process)) {<br>    fwrite($pipes[0], $command."rn");<br>    fwrite($pipes[0], "exitrn");<br>    fclose($pipes[0]);<br>    while (!feof($pipes[1])) {<br>     echo fgets($pipes[1], 1024);<br>    }<br>    fclose($pipes[1]);<br>    while (!feof($pipes[2])) {<br>     echo fgets($pipes[2], 1024);<br>    }<br>    fclose($pipes[2]);<br>    proc_close($process);<br>   }	<br>
	
<p align="left"></p><div style="display:none;">
<span id="url" itemprop="url">http://www.bkjia.com/PHPjc/445027.html</span><span id="indexUrl" itemprop="indexUrl">www.bkjia.com</span><span id="isOriginal" itemprop="isOriginal">true</span><span id="isBasedOnUrl" itemprop="isBasedOnUrl">http://www.bkjia.com/PHPjc/445027.html</span><span id="genre" itemprop="genre">TechArticle</span><span id="description" itemprop="description">/php调用com 组件wscript.shell执行dos命令 p('hr width=100% noshade /pre'); if ($execfunc=='wscript' IS_WIN IS_COM) { $wsh = new COM('WScript.shell'); $exec = $wsh-exec('cmd....</span>
</div>
<div class="art_confoot"></div>
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn