当前位置: 首页>>代码示例>>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;未经允许,请勿转载。