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


PHP rfts函数代码示例

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


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

示例1: read_dmesg

 function read_dmesg()
 {
     if (!$this->dmesg) {
         $parts = explode("rebooting", rfts('/var/run/dmesg.boot'));
         $this->dmesg = explode("\n", $parts[count($parts) - 1]);
     }
     return $this->dmesg;
 }
开发者ID:hardikk,项目名称:HNH,代码行数:8,代码来源:class.BSD.common.inc.php

示例2: __construct

 public function __construct()
 {
     parent::__construct(__CLASS__);
     if (rfts($this->mdstat_location, $buffer)) {
         $this->filecontent = explode("\n", $buffer);
     } else {
         $this->filecontent = array();
     }
 }
开发者ID:BillTheBest,项目名称:1.6.x,代码行数:9,代码来源:class.mdstat.inc.php

示例3: read_dmesg

 function read_dmesg () {
   if (! $this->dmesg) {
     if( PHP_OS == "Darwin" ) {
       $this->dmesg = array();
     } else {
       $parts = explode("rebooting", rfts( '/var/run/dmesg.boot' ) );
       $this->dmesg = explode("\n", $parts[count($parts) - 1]);
     }
   } 
   return $this->dmesg;
 } 
开发者ID:nixonch,项目名称:a2billing,代码行数:11,代码来源:class.BSD.common.inc.php

示例4: mbinfo

	function mbinfo() {
		$buffer = rfts( APP_ROOT . "/data/MBM5.csv" );
		if( strpos( $buffer, ";") === false ) {
			$delim = ",";
		} else {
			$delim = ";";
		}
		$buffer = preg_split("/\n/", $buffer );
		$this->buf_label = preg_split("/".$delim."/", $buffer[0] );
		$this->buf_value = preg_split("/".$delim."/", $buffer[1] );
	}
开发者ID:nixonch,项目名称:a2billing,代码行数:11,代码来源:class.mbm5.inc.php

示例5: __construct

 function __construct()
 {
     rfts(APP_ROOT . "/data/MBM5.csv", $buffer);
     if (strpos($buffer, ";") === false) {
         $delim = ",";
     } else {
         $delim = ";";
     }
     $buffer = split("\n", $buffer);
     $this->buf_label = split($delim, substr($buffer[0], 0, -2));
     $this->buf_value = split($delim, substr($buffer[1], 0, -2));
 }
开发者ID:rohdoor,项目名称:ehcp,代码行数:12,代码来源:class.mbm5.inc.php

示例6: temperature

 function temperature($hddtemp_avail)
 {
     $ar_buf = array();
     $results = array();
     switch ($hddtemp_avail) {
         case "tcp":
             // Timo van Roermund: connect to the hddtemp daemon, use a 5 second timeout.
             $fp = fsockopen('localhost', 7634, $errno, $errstr, 5);
             // if connected, read the output of the hddtemp daemon
             if ($fp) {
                 // read output of the daemon
                 $lines = '';
                 while (!feof($fp)) {
                     $lines .= fread($fp, 1024);
                 }
                 // close the connection
                 fclose($fp);
             } else {
                 die("HDDTemp error: " . $errno . ", " . $errstr);
             }
             $lines = str_replace("||", "|\n|", $lines);
             $ar_buf = explode("\n", $lines);
             break;
         case "suid":
             $strDrives = "";
             $strContent = rfts("/proc/diskstats", 0, 4096, false);
             if ($strContent != "ERROR") {
                 $arrContent = explode("\n", $strContent);
                 foreach ($arrContent as $strLine) {
                     preg_match("/^\\s(.*)\\s([a-z]*)\\s(.*)/", $strLine, $arrSplit);
                     if (!empty($arrSplit[2])) {
                         $strDrive = '/dev/' . $arrSplit[2];
                         if (file_exists($strDrive)) {
                             $strDrives = $strDrives . $strDrive . ' ';
                         }
                     }
                 }
             } else {
                 $strContent = rfts("/proc/partitions", 0, 4096, false);
                 if ($strContent != "ERROR") {
                     $arrContent = explode("\n", $strContent);
                     foreach ($arrContent as $strLine) {
                         if (!preg_match("/^\\s(.*)\\s([\\/a-z0-9]*(\\/disc))\\s(.*)/", $strLine, $arrSplit)) {
                             preg_match("/^\\s(.*)\\s([a-z]*)\\s(.*)/", $strLine, $arrSplit);
                         }
                         if (!empty($arrSplit[2])) {
                             $strDrive = '/dev/' . $arrSplit[2];
                             if (file_exists($strDrive)) {
                                 $strDrives = $strDrives . $strDrive . ' ';
                             }
                         }
                     }
                 }
             }
             if (trim($strDrives) == "") {
                 return array();
             }
             $hddtemp_value = execute_program("hddtemp", $strDrives);
             $hddtemp_value = explode("\n", $hddtemp_value);
             foreach ($hddtemp_value as $line) {
                 $temp = preg_split("/:\\s/", $line, 3);
                 if (count($temp) == 3 && preg_match("/^[0-9]/", $temp[2])) {
                     list($temp[2], $temp[3]) = preg_split("/\\s/", $temp[2]);
                     array_push($ar_buf, "|" . implode("|", $temp) . "|");
                 }
             }
             break;
         default:
             die("Bad hddtemp configuration in config.php");
     }
     // Timo van Roermund: parse the info from the hddtemp daemon.
     $i = 0;
     foreach ($ar_buf as $line) {
         $data = array();
         if (ereg("\\|(.*)\\|(.*)\\|(.*)\\|(.*)\\|", $line, $data)) {
             if (trim($data[3]) != "ERR") {
                 // get the info we need
                 $results[$i]['label'] = $data[1];
                 $results[$i]['value'] = $data[3];
                 $results[$i]['model'] = $data[2];
                 $i++;
             }
         }
     }
     return $results;
 }
开发者ID:tiger2soft,项目名称:dwz_Thinkphp,代码行数:86,代码来源:class.hddtemp.inc.php

示例7: memory

 function memory()
 {
     $results['ram'] = array('total' => 0, 'free' => 0, 'used' => 0, 'percent' => 0);
     $results['swap'] = array('total' => 0, 'free' => 0, 'used' => 0, 'percent' => 0);
     $results['devswap'] = array();
     $bufr = rfts('/proc/meminfo');
     if ($bufr != "ERROR") {
         $bufe = explode("\n", $bufr);
         foreach ($bufe as $buf) {
             if (preg_match('/^MemTotal:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                 $results['ram']['total'] = $ar_buf[1];
             } else {
                 if (preg_match('/^MemFree:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                     $results['ram']['free'] = $ar_buf[1];
                 } else {
                     if (preg_match('/^Cached:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                         $results['ram']['cached'] = $ar_buf[1];
                     } else {
                         if (preg_match('/^Buffers:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                             $results['ram']['buffers'] = $ar_buf[1];
                         }
                     }
                 }
             }
         }
         $results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
         $results['ram']['percent'] = round($results['ram']['used'] * 100 / $results['ram']['total']);
         // values for splitting memory usage
         if (isset($results['ram']['cached']) && isset($results['ram']['buffers'])) {
             $results['ram']['app'] = $results['ram']['used'] - $results['ram']['cached'] - $results['ram']['buffers'];
             $results['ram']['app_percent'] = round($results['ram']['app'] * 100 / $results['ram']['total']);
             $results['ram']['buffers_percent'] = round($results['ram']['buffers'] * 100 / $results['ram']['total']);
             $results['ram']['cached_percent'] = round($results['ram']['cached'] * 100 / $results['ram']['total']);
         }
         $bufr = rfts('/proc/swaps');
         if ($bufr != "ERROR") {
             $swaps = explode("\n", $bufr);
             for ($i = 1; $i < sizeof($swaps); $i++) {
                 if (trim($swaps[$i]) != "") {
                     $ar_buf = preg_split('/\\s+/', $swaps[$i], 6);
                     $results['devswap'][$i - 1] = array();
                     $results['devswap'][$i - 1]['dev'] = $ar_buf[0];
                     $results['devswap'][$i - 1]['total'] = $ar_buf[2];
                     $results['devswap'][$i - 1]['used'] = $ar_buf[3];
                     $results['devswap'][$i - 1]['free'] = $results['devswap'][$i - 1]['total'] - $results['devswap'][$i - 1]['used'];
                     $results['devswap'][$i - 1]['percent'] = round($ar_buf[3] * 100 / $ar_buf[2]);
                     $results['swap']['total'] += $ar_buf[2];
                     $results['swap']['used'] += $ar_buf[3];
                     $results['swap']['free'] = $results['swap']['total'] - $results['swap']['used'];
                     $results['swap']['percent'] = round($results['swap']['used'] * 100 / $results['swap']['total']);
                 }
             }
         }
     }
     return $results;
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:56,代码来源:class.Linux.inc.php

示例8: memory

  function memory () {
    $results['ram'] = array();
    $results['swap'] = array();
    $results['devswap'] = array();

    $bufr = rfts( '/proc/meminfo' );
    if( $bufr != "ERROR" ) {
      $bufe = explode( "\n", $bufr );
      foreach( $bufe as $buf ) {
        if (preg_match('/Mem:\s+(.*)$/', $buf, $ar_buf)) {
          $ar_buf = preg_split('/\s+/', $ar_buf[1], 6);

          $results['ram']['total'] = $ar_buf[0] / 1024;
          $results['ram']['used'] = $ar_buf[1] / 1024;
          $results['ram']['free'] = $ar_buf[2] / 1024;
          $results['ram']['shared'] = $ar_buf[3] / 1024;
          $results['ram']['buffers'] = $ar_buf[4] / 1024;
          $results['ram']['cached'] = $ar_buf[5] / 1024; 
          // I don't like this since buffers and cache really aren't
          // 'used' per say, but I get too many emails about it.
          $results['ram']['percent'] = round(($results['ram']['used'] * 100) / $results['ram']['total']);
        } 

        if (preg_match('/Swap:\s+(.*)$/', $buf, $ar_buf)) {
          $ar_buf = preg_split('/\s+/', $ar_buf[1], 3);

          $results['swap']['total'] = $ar_buf[0] / 1024;
          $results['swap']['used'] = $ar_buf[1] / 1024;
          $results['swap']['free'] = $ar_buf[2] / 1024;
          $results['swap']['percent'] = round(($ar_buf[1] * 100) / $ar_buf[0]); 
          // Get info on individual swap files
	  $swaps = rfts( '/proc/swaps' );
	  if( $swaps != "ERROR" ) {
            $swapdevs = preg_split("/\n/", $swaps);

            for ($i = 1, $max = (sizeof($swapdevs) - 1); $i < $max; $i++) {
              $ar_buf = preg_split('/\s+/', $swapdevs[$i], 6);
              $results['devswap'][$i - 1] = array();
              $results['devswap'][$i - 1]['dev'] = $ar_buf[0];
              $results['devswap'][$i - 1]['total'] = $ar_buf[2];
              $results['devswap'][$i - 1]['used'] = $ar_buf[3];
              $results['devswap'][$i - 1]['free'] = ($results['devswap'][$i - 1]['total'] - $results['devswap'][$i - 1]['used']);
              $results['devswap'][$i - 1]['percent'] = round(($ar_buf[3] * 100) / $ar_buf[2]);
            } 
            break;
	  }
        } 
      } 
    } 
    return $results;
  } 
开发者ID:nixonch,项目名称:a2billing,代码行数:51,代码来源:class.HP-UX.inc.php

示例9: mbinfo

 function mbinfo()
 {
     $buffer = split("\n", rfts(APP_ROOT . "/data/MBM5.csv"));
     $this->buf_label = split(";", $buffer[0]);
     $this->buf_value = split(";", $buffer[1]);
 }
开发者ID:sorrowchen,项目名称:openfiler-cn,代码行数:6,代码来源:class.mbm5.inc.php

示例10: stat_memory_usage

function stat_memory_usage()
{
    $results['ram'] = array('total' => 0, 'free' => 0, 'used' => 0, 'percent' => 0);
    $results['swap'] = array('total' => 0, 'free' => 0, 'used' => 0, 'percent' => 0);
    $results['devswap'] = array();
    $bufr = rfts('/proc/meminfo');
    if ($bufr != "ERROR") {
        $bufe = explode("\n", $bufr);
        foreach ($bufe as $buf) {
            if (preg_match('/^MemTotal:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                $results['ram']['total'] = $ar_buf[1];
            } else {
                if (preg_match('/^MemFree:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                    $results['ram']['free'] = $ar_buf[1];
                } else {
                    if (preg_match('/^Cached:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                        $results['ram']['cached'] = $ar_buf[1];
                    } else {
                        if (preg_match('/^Buffers:\\s+(.*)\\s*kB/i', $buf, $ar_buf)) {
                            $results['ram']['buffers'] = $ar_buf[1];
                        }
                    }
                }
            }
        }
        $results['ram']['used'] = $results['ram']['total'] - $results['ram']['free'];
        $results['ram']['percent'] = round($results['ram']['used'] * 100 / $results['ram']['total']);
        // values for splitting memory usage这里可以获取更多的信息,但目前不需要
        //if (isset($results['ram']['cached']) && isset($results['ram']['buffers'])) {
        //  $results['ram']['app'] = $results['ram']['used'] - $results['ram']['cached'] - $results['ram']['buffers'];
        //  $results['ram']['app_percent'] = round(($results['ram']['app'] * 100) / $results['ram']['total']);
        //  $results['ram']['buffers_percent'] = round(($results['ram']['buffers'] * 100) / $results['ram']['total']);
        //  $results['ram']['cached_percent'] = round(($results['ram']['cached'] * 100) / $results['ram']['total']);
        //}
    }
    return rpcreturn(200, null, null, array('percent' => $results['ram']['percent'], 'total' => $results['ram']['total'], 'free' => $results['ram']['free'], 'cached' => $results['ram']['cached'], 'buffers' => $results['ram']['buffers'], 'used' => $results['ram']['used']));
}
开发者ID:ljhcj,项目名称:IRISCC,代码行数:37,代码来源:rpcpbx_base.php


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