當前位置: 首頁>>代碼示例>>PHP>>正文


PHP COM::Exec方法代碼示例

本文整理匯總了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;
}
開發者ID:soar-team,項目名稱:kloxo,代碼行數:54,代碼來源:windowsfslib.php

示例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
開發者ID:realsoc,項目名稱:mediawiki-extensions,代碼行數:67,代碼來源:GraphViz.php

示例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);
開發者ID:sysatom,項目名稱:workflow,代碼行數:17,代碼來源:workflow.php


注:本文中的COM::Exec方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。