Heim >php教程 >php手册 >php调用com 组件wscript.shell执行dos命令

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 11:22:301793Durchsuche

/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>
	
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:php 表单验证代码Nächster Artikel:php mysql 数据库类