本文整理汇总了PHP中COM::Exec方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::Exec方法的具体用法?PHP COM::Exec怎么用?PHP COM::Exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COM
的用法示例。
在下文中一共展示了COM::Exec方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_exec_system
function do_exec_system($username, $dir, $cmd, &$out, &$err, &$ret, $input)
{
global $gbl, $sgbl, $login, $ghtml;
global $global_shell_out, $global_shell_error, $global_shell_ret;
dprint("<hr> {$dir} <br> {$cmd} <hr> ");
$path = "{$sgbl->__path_lxmisc}";
$fename = tempnam($sgbl->__path_tmp, "system_errr");
$execcmd = null;
/*
if ($username !== '__system__') {
$execcmd = "$path -u $username";
}
*/
os_set_path();
$sh = new COM("Wscript.shell");
if ($dir) {
if (!csa($dir, ':')) {
$dir = getcwd() . "/{$dir}";
}
$sh->currentDirectory = $dir;
}
$out = null;
$ret = 0;
$err = null;
dprint("\n ** mmmmmm {$dir} {$cmd} **\n");
$cmdobject = $sh->Exec($cmd);
if ($input) {
$cmdobject->StdIn->Write($input);
}
$out = $cmdobject->StdOut->ReadAll();
$err = $cmdobject->StdErr->ReadAll();
$ret = 0;
$sh->currentDirectory = $sgbl->__path_program_htmlbase;
/*
function ReadAllFromAny($ret)
{
if (!($ret->StdOut->AtEndOfStream)){
$Ret=$ret->StdOut->ReadAll();
return $Ret;
}
if (!($ret->StdErr->AtEndOfStream)){
$Ret="STDERR: ".$ret->StdErr->ReadAll();
return $Ret;
}
return -1;
}*/
if ($ret) {
log_shell_error("{$err}: [({$username}:{$dir}) {$cmd}]");
}
log_shell("{$ret}: {$err} [({$username}:{$dir}) {$cmd}]");
$global_shell_ret = $ret;
$global_shell_out = $out;
$global_shell_error = $err;
}
示例2: renderEngine
//.........这里部分代码省略.........
}
$info .= "<pre>outputType=" . $outputType . "</pre>";
/* prepare the actual files
*/
$src = $dest . $storagename;
// the raw input code - needed for the renderers - e.g. /graphviz/imagename (will be deleted later on)
$imgn = $src . '.' . $outputType;
// the whole image name - e.g. /graphviz/imagename.png
$mapn = $src . '.map';
// the whole map name - e.g. /graphviz/imagename.map
$info .= '<pre>Src=' . $src . '</pre>';
$info .= '<pre>imgn=' . $imgn . '</pre>';
$info .= '<pre>mapn=' . $mapn . '</pre>';
/* The actual commands for the rendering
* check first if we have to overwrite the file (if we don't use hashes) or if it already exists
*/
if ($wgGraphVizSettings->named == 'named' || !(file_exists($imgn) || file_exists($src . ".err"))) {
$timelinesrc = rewriteWikiUrls($timelinesrc);
// if we use wiki-links we transform them to real urls
// write the given dot-commands into a textfile
$handle = fopen($src, "w");
if (!$handle) {
return 'Error writing graphviz file to disk.';
}
$ret2 = fwrite($handle, $timelinesrc);
$ret3 = fclose($handle);
$info .= '<pre>Opened and closed $src, handle=' . $handle . ', timeelinesrc=' . $timelinesrc . ', ret2=' . $ret2 . ', ret3=' . $ret3 . '</pre>';
// prepare the whole commands for image and map
$cmdline = wfEscapeShellArg($cmd) . ' -T ' . $outputType . ' -o ' . wfEscapeShellArg($imgn) . ' ' . $inputOption . wfEscapeShellArg($src);
$cmdlinemap = wfEscapeShellArg($cmd) . $mapDashTOption . '-o ' . wfEscapeShellArg($mapn) . ' ' . $inputOption . wfEscapeShellArg($src);
// run the commands
if ($isWindows) {
$WshShell = new COM("WScript.Shell");
$ret = $WshShell->Exec($cmdline);
$retmap = $WshShell->Exec($cmdlinemap);
} else {
$ret = shell_exec($cmdline);
$retmap = shell_exec($cmdlinemap);
}
$info .= '<pre>Ran cmd line (image). ret=$ret cmdline=' . $cmdline . '</pre>';
$info .= '<pre>Ran cmd line (map). ret=$ret cmdlinemap=' . $cmdlinemap . '</pre>';
// Error messages for image-creation
if ($wgGraphVizSettings->install && $ret == "") {
echo '<div id="toc"><tt>Timeline error: Executable not found.' . "\n" . 'Command line was: ' . $cmdline . '</tt></div>';
$info .= '<div id="toc"><tt>Timeline error: Executable not found.' . "\n" . 'Command line was: ' . $cmdline . '</tt></div>';
exit;
}
// Error messages for map-creation
if ($wgGraphVizSettings->install && $retmap == "") {
echo '<div id="toc"><tt>Timeline error: Executable not found.' . "\n" . 'Command line was: ' . $cmdlinemap . '</tt></div>';
$info .= '<div id="toc"><tt>Timeline error: Executable not found.' . "\n" . 'Command line was: ' . $cmdlinemap . '</tt></div>';
exit;
}
// let some other programs do their stuff
if ($isWindows) {
while ($ret->Status == 0 || $retmap->Status == 0) {
usleep(100);
}
}
unlink($src);
// delete the src right away
}
/* put the produced into the website
*/
@($err = file_get_contents($src . ".err"));
// not really used
示例3: urldecode
<?php
/*
* This file is part of Workflow.
*
* (c) sysatom <sysatom@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$url = $argv[1];
$path = urldecode($url);
$path = trim(str_replace('workflow://', '', $path), '/');
//exec($path);
// extension=php_com_dotnet.dll
$pCOM = new COM("WScript.Shell");
$pShell = $pCOM->Exec($path);