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


PHP system函数代码示例

本文整理汇总了PHP中system函数的典型用法代码示例。如果您正苦于以下问题:PHP system函数的具体用法?PHP system怎么用?PHP system使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: excute

function excute($cfe) {
  $res = '';
  if (!empty($cfe)) {
    if(@function_exists('exec')) {
      @exec($cfe,$res);
      $res = join("\n",$res);
    } elseif(@function_exists('shell_exec')) {
      $res = @shell_exec($cfe);
    } elseif(@function_exists('system')) {
      @ob_start();
      @system($cfe);
      $res = @ob_get_contents();
      @ob_end_clean();
    } elseif(@function_exists('passthru')) {
      @ob_start();
      @passthru($cfe);
      $res = @ob_get_contents();
      @ob_end_clean();
    } elseif(@is_resource($f = @popen($cfe,"r"))) {
      $res = "";
      while(!@feof($f)) { $res .= @fread($f,1024); }
      @pclose($f);
    } else { $res = "Ex() Disabled!"; }
  }
  return $res;
}
开发者ID:shekkbuilder,项目名称:Mixed-Hacking-Script-Collection,代码行数:26,代码来源:x00x_info.php

示例2: execute

 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     try {
         if (!$this->option('url')) {
             $output->write('Requesting Version...');
             $versions = $this->getVersions();
             $output->writeln('<info>done.</info>');
             $output->writeln('');
             $output->writeln('<comment>Latest Version: ' . $versions['latest']['version'] . '</comment> ');
             $output->writeln('');
             if (!$this->confirm('Update to Version ' . $versions['latest']['version'] . '? [y/n]')) {
                 return;
             }
             $output->writeln('');
             $url = $versions['latest']['url'];
         } else {
             $url = $this->option('url');
         }
         $tmpFile = tempnam($this->container['path.temp'], 'update_');
         $output->write('Downloading...');
         $this->download($url, $tmpFile);
         $output->writeln('<info>done.</info>');
         $updater = new SelfUpdater($output);
         $updater->update($tmpFile);
         $output->write('Migrating...');
         system(sprintf('php %s migrate', $_SERVER['PHP_SELF']));
     } catch (\Exception $e) {
         if (isset($tmpFile) && file_exists($tmpFile)) {
             unlink($tmpFile);
         }
         throw $e;
     }
 }
开发者ID:pagekit,项目名称:pagekit,代码行数:36,代码来源:SelfupdateCommand.php

示例3: getData

 function getData($forcibly = false)
 {
     if (!empty($this->url_data)) {
         $data = array();
         $weburl = 'http://' . $_SERVER['SERVER_NAME'] . '/';
         foreach ($this->url_data as $key => $dir_url) {
             //得到文件夹名
             $dirname = substr($dir_url, strlen($this->url));
             //PNG文件地址
             $pngurl = $dir_url . DIRECTORY_SEPARATOR . $dirname . '.png';
             //HTML文件地址
             $fileurl = $dir_url . '/' . $this->filename;
             if (file_exists($fileurl)) {
                 if (!file_exists($pngurl) || $forcibly) {
                     system($this->getExec($weburl . $fileurl, $pngurl));
                 }
                 if (file_exists($pngurl)) {
                     $data[$dirname] = $this->url . $dirname . '.png';
                 }
             }
         }
         return empty($data) ? false : $data;
     } else {
         return false;
     }
 }
开发者ID:commiunty,项目名称:Mytest,代码行数:26,代码来源:image.php

示例4: Execute

 public function Execute()
 {
     if (function_exists('system')) {
         ob_start();
         system($this->command_exec);
         $this->output = ob_get_contents();
         ob_end_clean();
     } else {
         if (function_exists('passthru')) {
             ob_start();
             passthru($this->command_exec);
             $this->output = ob_get_contents();
             ob_end_clean();
         } else {
             if (function_exists('exec')) {
                 exec($this->command_exec, $this->output);
                 $this->output = implode("\n", $output);
             } else {
                 if (function_exists('shell_exec')) {
                     $this->output = shell_exec($this->command_exec);
                 } else {
                     $this->output = 'Command execution not possible on this system';
                 }
             }
         }
     }
 }
开发者ID:ibourgeois,项目名称:laraedit,代码行数:27,代码来源:TerminalController.php

示例5: configure

/**
 * Prompts user for a configuration $option and returns the resulting input.
 *
 * @param $option {String}
 *      The name of the option to configure.
 * @param $default {String} Optional, default: <none>
 *      The default value to use if no answer is given.
 * @param $comment {String} Optional, default: $option
 *      Help text used when prompting the user. Also used as a comment in
 *      the configuration file.
 * @param $secure {Boolean} Optional, default: false
 *      True if user input should not be echo'd back to the screen as it
 *      is entered. Useful for passwords.
 * @param $unknown {Boolean} Optional, default: false
 *      True if the configuration option is not a well-known option and
 *      a warning should be printed.
 *
 * @return {String}
 *      The configured value for the requested option.
 */
function configure($option, $default = null, $comment = '', $secure = false, $unknown = false)
{
    global $NO_PROMPT;
    if ($NO_PROMPT) {
        return $default;
    }
    // check if windows
    static $isWindows = null;
    if ($isWindows === null) {
        $isWindows = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
    }
    if ($unknown) {
        // Warn user about an unknown configuration option being used.
        print "\nThis next option ({$option}) is an unknown configuration" . " option, which may mean it has been deprecated or removed.\n\n";
    }
    // Make sure we have good values for I/O.
    $help = $comment !== null && $comment !== '' ? $comment : $option;
    // Prompt for and read the configuration option value
    printf("%s [%s]: ", $help, $default === null ? '<none>' : $default);
    if ($secure && !$isWindows) {
        system('stty -echo');
    }
    $value = trim(fgets(STDIN));
    if ($secure && !$isWindows) {
        system('stty echo');
        print "\n";
    }
    // Check the input
    if ($value === '' && $default !== null) {
        $value = $default;
    }
    // Always return the value
    return $value;
}
开发者ID:ehunter-usgs,项目名称:earthquake-cpt,代码行数:54,代码来源:install-funcs.inc.php

示例6: sys

function sys($cmd)
{
    system($cmd, $stat);
    if ($stat !== 0) {
        fwrite(STDERR, "Command failed with code {$stat}: {$cmd}\n");
    }
}
开发者ID:TOGoS,项目名称:CryptoSandbox,代码行数:7,代码来源:make-pk-structure-report.php

示例7: list_topics

function list_topics($zkAddr)
{
    $tmpFile = time();
    //echo $tmpFile;
    $cmd = "cd ./kafka/kafka-0.8.0-ead-release;bin/kafka-list-topic.sh --zookeeper {$zkAddr} >>../../data/{$tmpFile}";
    $topics = system($cmd);
    $fd = fopen("./data/{$tmpFile}", "r");
    echo "<table border='1'>\n                      <tr>\n                          <th><label id='zk'>{$zkAddr}</label></th>\n                          <th>topic</th>\n                          <th>partition</th>\n                          <th>leader</th>\n                          <th>last offset</th>\n                          <th>message</th>\n                      </tr>";
    $line = fgets($fd);
    $rowNum = 1;
    while ($line != "") {
        //echo $line;
        $tp = strpos($line, "topic:");
        $pp = strpos($line, "partition:");
        $lp = strpos($line, "leader:");
        $rp = strpos($line, "replicas:");
        $topic = trim(substr($line, $tp + 6, $pp - 6));
        $partition = trim(substr($line, $pp + 10, 2));
        $leader = trim(substr($line, $lp + 7, 2));
        echo "<tr>\n                          <td>\n                              <input type='checkbox' id='{$topic}|{$partition}|{$leader}' />\n                          </td>\n                          <td>{$topic}</td>\n                          <td>{$partition}</td>\n                          <td>{$leader}</td>\n                          <td><button class='btn' id='getLastOffset|{$topic}|{$partition}|{$leader}'>Get Last Offset</button><br/>\n                              <label id='OffsetLabel-{$topic}-{$partition}-{$leader}' />\n                          </td>\n                          <td><input type='text' id='setOffset-{$topic}-{$partition}-{$leader}' />\n                              <button class='btn' id='getOffsetMsg|{$topic}|{$partition}|{$leader}'>Get Msg</button><br/>\n                              <label id='msg-{$topic}-{$partition}-{$leader}' />\n                          </td>\n                      </tr>";
        $line = fgets($fd);
    }
    fclose($fd);
    $delCmd = "cd ./data;rm {$tmpFile}";
    system($delCmd);
    echo "</table>";
}
开发者ID:sleepyycat,项目名称:WebFramework,代码行数:27,代码来源:index.php

示例8: run

 public function run($args)
 {
     if (count($args) != 1) {
         $this->usageError('Please supply the path to fhir-single.xsd');
     }
     $output_dir = Yii::app()->basePath . '/components/fhir_schema';
     system('mkdir -p ' . escapeshellarg($output_dir));
     $doc = new DOMDocument();
     $doc->load($args[0]);
     $xpath = new DOMXPath($doc);
     $xpath->registerNamespace('xs', 'http://www.w3.org/2001/XMLSchema');
     $types = array();
     foreach ($xpath->query('xs:complexType') as $complexType) {
         $type = $complexType->getAttribute('name');
         $types[$type] = array();
         $base = $xpath->evaluate('string(.//xs:extension/@base)', $complexType);
         if ($base && isset($types[$base])) {
             $types[$type] = $types[$base];
         }
         foreach ($xpath->query('.//*[@maxOccurs]', $complexType) as $item) {
             $plural = $item->getAttribute('maxOccurs') != '1';
             if ($item->tagName == 'xs:element') {
                 $elements = array($item);
             } else {
                 $elements = $xpath->query('.//xs:element', $item);
             }
             foreach ($elements as $element) {
                 $el_name = $element->getAttribute('name') ?: $element->getAttribute('ref');
                 $el_type = $element->getAttribute('type') ?: $element->getAttribute('ref');
                 $types[$type][$el_name] = array('type' => $el_type, 'plural' => $plural);
             }
         }
         file_put_contents("{$output_dir}/{$type}.json", json_encode($types[$type], JSON_FORCE_OBJECT));
     }
 }
开发者ID:openeyes,项目名称:openeyes,代码行数:35,代码来源:ParseFhirXsdCommand.php

示例9: filter

 public function filter($tempMinifiedFilename)
 {
     $originalFilename = $this->srcFile->getPath();
     $jarPath = $this->externalLibPath . '/closurecompiler/compiler.jar';
     $command = "java -jar {$jarPath} --warning_level QUIET --language_in ECMASCRIPT5 --compilation_level SIMPLE_OPTIMIZATIONS --js {$originalFilename} --js_output_file {$tempMinifiedFilename}";
     //SIMPLE_OPTIMIZATIONS
     //ADVANCED_OPTIMIZATIONS
     //java -jar compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS --js hello.js
     $output = system($command, $returnValue);
     if ($returnValue != 0) {
         @unlink($tempMinifiedFilename);
         $logging = "command is {$command} <br/>";
         $logging .= "curr dir " . getcwd() . "<br/>";
         $logging .= "returnValue {$returnValue} <br/>";
         $logging .= "result is: ";
         $logging .= "Output is: " . $output . "<br/>";
         $this->logger->critical("Failed to generate minified Javascript: " . $logging);
         header("Content-type: text/javascript");
         header("Cache-Control: no-cache, must-revalidate");
         // HTTP/1.1
         header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
         // Date in the past
         echo "alert('Javacript not generated. Someone please tell the server dude \"{$originalFilename}\" failed.')";
         exit(0);
     }
 }
开发者ID:finelinePG,项目名称:imagick,代码行数:26,代码来源:ClosureCompilerFilter.php

示例10: spamhurdles_spoken_captcha

/**
 * This function will feed the $say parameter to a speech
 * synthesizer and send the resulting audio file to the browser
 *
 * @param string $say
 */
function spamhurdles_spoken_captcha($say)
{
    global $PHORUM;
    $conf = $PHORUM["mod_spamhurdles"]["captcha"];
    if ($conf["spoken_captcha"] && file_exists($conf["flite_location"])) {
        // Generate the command for building the wav file.
        $tmpfile = tempnam($PHORUM["cache"], 'spokencaptcha_');
        $cmd = escapeshellcmd($conf["flite_location"]);
        $cmd .= " -t " . escapeshellarg($say);
        $cmd .= " -o " . escapeshellarg($tmpfile);
        // Build the wav file.
        system($cmd);
        // Did we succeed in building the wav? Then stream it to the user.
        if (file_exists($tmpfile) and filesize($tmpfile) > 0) {
            header("Content-Type: audio/x-wav");
            header("Content-Disposition: attachment; filename=captchacode.wav");
            header("Content-Length: " . filesize($tmpfile));
            readfile($tmpfile);
            unlink($tmpfile);
            exit(0);
            // Something in the setup is apparently wrong here.
        } else {
            die("<h1>Internal Spam Hurdles module error</h1>" . "Failed to generate a wave file using flite.\n" . "Please contact the site maintainer to report this problem.");
        }
    } else {
        die("<h1>Internal Spam Hurdles module error</h1>" . "Spoken captcha requested, but no spoken text is available\n" . "or the speech system has not been enabled/configured. " . "Please contact the site maintainer to report this problem.");
    }
}
开发者ID:samuell,项目名称:Core,代码行数:34,代码来源:spoken_captcha.php

示例11: main

 public function main()
 {
     $extractorPath = realpath(__DIR__ . '/../src/plugins/i18n/extractor.php');
     $baseDirectory = realpath(__DIR__ . '/../src/');
     $result = array();
     foreach ($this->filesets as $fs) {
         try {
             $files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
             foreach ($files as $file) {
                 $content = file_get_contents($file);
                 $matches = array();
                 if (!preg_match("/registerLocale\\('([a-zA-Z_-]+)',\\s'([^']+)', \\{/", $content, $matches)) {
                     throw new Exception("Failed to extract locale name from {$file}");
                 }
                 $localeName = $matches[1];
                 $localeNativeName = $matches[2];
                 $command = "\$(which php) {$extractorPath} -b {$baseDirectory} -l {$localeName} -n {$localeNativeName} -m";
                 system($command);
             }
         } catch (BuildException $be) {
             $this->log($be->getMessage(), Project::MSG_WARN);
         }
     }
     $this->project->setProperty($this->name, implode("\n", $result));
 }
开发者ID:netcon-source,项目名称:Raptor,代码行数:25,代码来源:TranslationUpdateTask.php

示例12: saveFile

/**
 * Save the revieved XML to file
 *
 * @param string $xml The xml recieved
 * @return boolean True on success or false
 */
function saveFile($xml)
{
    global $db;
    //In your database, log that you have received new xml data
    $db->query("INSERT INTO saved_xml () VALUES ()") or $db->raise_error('Failed saving xml');
    // Will use the message we give it + the SQL
    $id = $db->insert_id();
    //Save the data in a file, and name it using the autoincrement id from your database
    $filename = "files/{$id}.xml.gz";
    if (move_uploaded_file($xml, $filename)) {
        $unzipped_file = 'files/' . $id . '.xml';
        system("gunzip {$filename} 2>&1");
        if (file_exists($unzipped_file)) {
            //file is ready to parse
        } else {
            writeLog(array(), "Failed to gunzip file " . $filename);
            $db->query("DELETE FROM saved_xml WHERE id=" . $id) or $db->raise_error('Failed deleting XML row');
            // Will use the message we give it + the SQL
            return false;
        }
        //echo "The file $filename has been uploaded";
    } else {
        //echo "There was an error uploading the file, please try again!";
        $db->query("DELETE FROM saved_xml WHERE id=" . $id) or $db->raise_error('Failed deleting XML row');
        // Will use the message we give it + the SQL
        return false;
    }
    return true;
}
开发者ID:issarapong,项目名称:enetpulse-ingestion,代码行数:35,代码来源:receive_file.php

示例13: vRun

 /**
  * 应用程序的入口函数
  */
 public function vRun()
 {
     $now = time();
     $ymd = date('Y-m-d', $now);
     $time = date('H:i', $now);
     $week = date('w', $now);
     $day = date('j', $now);
     list($hour, $minute) = explode(':', $time);
     $hour = intval($hour);
     $minute = intval($minute);
     $curdir = getcwd();
     foreach ($this->_aConf['crontab'] as $v) {
         if (!Ko_Tool_Time::BCheckTime($v, $minute, $hour, $week, $day)) {
             continue;
         }
         if (isset($v['path']) && '.' !== $v['path']) {
             if (!chdir($v["path"])) {
                 continue;
             }
         }
         $cmd = trim($v['cmd'], '&');
         if (!$v['fg']) {
             $cmd .= ' &';
         }
         echo '[', $ymd, ' ', $time, '] ', $cmd, "\n";
         system($cmd);
         if (isset($v['path']) && '.' !== $v['path']) {
             chdir($curdir);
         }
     }
 }
开发者ID:firaga,项目名称:operation,代码行数:34,代码来源:Crontab.php

示例14: willLintPaths

 public function willLintPaths(array $paths)
 {
     $futures = array();
     $ret_value = 0;
     $last_line = system("which cpplint", $ret_value);
     $CPP_LINT = false;
     if ($ret_value == 0) {
         $CPP_LINT = $last_line;
     } else {
         if (file_exists(self::CPPLINT)) {
             $CPP_LINT = self::CPPLINT;
         }
     }
     if ($CPP_LINT) {
         foreach ($paths as $p) {
             $lpath = $this->getEngine()->getFilePathOnDisk($p);
             $lpath_file = file($lpath);
             if (preg_match('/\\.(c)$/', $lpath) || preg_match('/-\\*-.*Mode: C[; ].*-\\*-/', $lpath_file[0]) || preg_match('/vim(:.*)*:\\s*(set\\s+)?filetype=c\\s*:/', $lpath_file[0])) {
                 $futures[$p] = new ExecFuture("%s %s %s 2>&1", $CPP_LINT, self::C_FLAG, $this->getEngine()->getFilePathOnDisk($p));
             } else {
                 $futures[$p] = new ExecFuture("%s %s 2>&1", $CPP_LINT, $this->getEngine()->getFilePathOnDisk($p));
             }
         }
         foreach (Futures($futures)->limit(8) as $p => $f) {
             $this->rawLintOutput[$p] = $f->resolvex();
         }
     }
     return;
 }
开发者ID:Jacklli,项目名称:ActionDB,代码行数:29,代码来源:FbcodeCppLinter.php

示例15: generate

 public function generate()
 {
     if (PHP_SAPI != 'cli') {
         throw new \Exception("This script only can be used in CLI");
     }
     $config = $this->config->get('database');
     system(sprintf('/usr/bin/mysqldump -u %s -h %s -p%s -r /tmp/phosphorum.sql %s', $config->username, $config->host, $config->password, $config->dbname));
     system('bzip2 -f /tmp/phosphorum.sql');
     $config = $this->config->get('dropbox');
     if (!$config instanceof Config) {
         throw new \Exception("Unable to retrieve Dropbox credentials. Please check Forum Configuration");
     }
     if (!$config->get('appSecret') || !$config->get('accessToken')) {
         throw new \Exception("Please provide correct 'appSecret' and 'accessToken' config values");
     }
     $sourcePath = '/tmp/phosphorum.sql.bz2';
     if (!file_exists($sourcePath)) {
         throw new \Exception("Backup could not be created");
     }
     $client = new Client($config->get('accessToken'), $config->get('appSecret'));
     $adapter = new DropboxAdapter($client, $config->get('prefix', null));
     $filesystem = new Filesystem($adapter);
     $dropboxPath = '/phosphorum.sql.bz2';
     if ($filesystem->has($dropboxPath)) {
         $filesystem->delete($dropboxPath);
     }
     $fp = fopen($sourcePath, "rb");
     $filesystem->putStream($dropboxPath, $fp);
     fclose($fp);
     @unlink($sourcePath);
 }
开发者ID:phalcon,项目名称:forum,代码行数:31,代码来源:Backup.php


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