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


PHP posix_uname函数代码示例

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


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

示例1: __construct

 function __construct($params)
 {
     if (isset($params['mailname'])) {
         $this->mailname = $params['mailname'];
     } else {
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             $this->mailname = $uname['nodename'];
         }
     }
     if (isset($params['port'])) {
         $this->_port = $params['port'];
     } else {
         $this->_port = getservbyname('smtp', 'tcp');
     }
     if (isset($params['timeout'])) {
         $this->timeout = $params['timeout'];
     }
     if (isset($params['verp'])) {
         $this->verp = $params['verp'];
     }
     if (isset($params['test'])) {
         $this->test = $params['test'];
     }
     if (isset($params['peardebug'])) {
         $this->test = $params['peardebug'];
     }
     if (isset($params['netdns'])) {
         $this->withNetDns = $params['netdns'];
     }
 }
开发者ID:MMU-TWT-Class-Oct-2015,项目名称:G10B_Sales_of_Point_System_for_Video_and_Audio_shop,代码行数:31,代码来源:smtpmx.php

示例2: getIdc

 private static function getIdc()
 {
     $uname = posix_uname();
     $hostname = $uname["nodename"];
     $words = explode(".", $hostname);
     $cluster = $words[count($words) - 3];
     return $cluster;
 }
开发者ID:sdgdsffdsfff,项目名称:qconf-inner,代码行数:8,代码来源:QconfExtra.php

示例3: report

 public static function report($topic, $msg, $email = '')
 {
     /*{{{*/
     $sysinfo = posix_uname();
     $nodename = $sysinfo['nodename'];
     if (empty($email)) {
         $email = ALARM_EMAIL;
     }
     return mail($email, 'phpcron-' . $nodename . '-' . $topic, $msg);
 }
开发者ID:sdgdsffdsfff,项目名称:xcron,代码行数:10,代码来源:logger.php

示例4: __construct

 /**
  * Constroi o objeto de conexão HTTP.
  *
  * @param string $client
  */
 public function __construct($client = 'SDK PHP')
 {
     if (self::$userAgent == null) {
         $locale = setlocale(LC_ALL, null);
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s; %s; %s)', $client, PHP_SAPI, PHP_VERSION, $uname['sysname'], $uname['machine'], $locale);
         } else {
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s; %s)', $client, PHP_SAPI, PHP_VERSION, PHP_OS, $locale);
         }
     }
 }
开发者ID:moip,项目名称:moip-http-php,代码行数:17,代码来源:HTTPConnection.php

示例5: get_loadavg

/**
* get 1 minute load average
*/
function get_loadavg()
{
    $uname = posix_uname();
    switch ($uname['sysname']) {
        case 'Linux':
            return linux_loadavg();
            break;
        case 'FreeBSD':
            return freebsd_loadavg();
            break;
        default:
            return -1;
    }
}
开发者ID:s-a-r-id,项目名称:geograph-project,代码行数:17,代码来源:recreate_maps.php

示例6: __construct

 /**
  * @brief	Constroi o objeto de conexão HTTP.
  */
 public function __construct()
 {
     if (self::$userAgent == null) {
         $locale = setlocale(LC_ALL, null);
         if (function_exists('posix_uname')) {
             $uname = posix_uname();
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s; %s %s; %s)', PHP_SAPI, PHP_VERSION, $uname['sysname'], $uname['machine'], $locale);
         } else {
             self::$userAgent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s; %s; %s)', PHP_SAPI, PHP_VERSION, PHP_OS, $locale);
         }
     }
     $this->requestHeader = array();
     $this->requestParameter = array();
 }
开发者ID:imastersdev,项目名称:correios,代码行数:17,代码来源:HTTPConnection.php

示例7: createNewSession

 /**
  * Creates a new Request_Session with all the default values.
  * A Session is created at construction.
  *
  * @param float $timeout         How long should we wait for a response?(seconds with a millisecond precision, default: 30, example: 0.01).
  * @param float $connect_timeout How long should we wait while trying to connect? (seconds with a millisecond precision, default: 10, example: 0.01)
  */
 public function createNewSession($timeout = 30.0, $connect_timeout = 30.0)
 {
     if (function_exists('posix_uname')) {
         $uname = posix_uname();
         $user_agent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s; %s)', self::CLIENT, PHP_SAPI, PHP_VERSION, $uname['sysname'], $uname['machine']);
     } else {
         $user_agent = sprintf('Mozilla/4.0 (compatible; %s; PHP/%s %s; %s)', self::CLIENT, PHP_SAPI, PHP_VERSION, PHP_OS);
     }
     $sess = new Requests_Session($this->endpoint);
     $sess->options['auth'] = $this->moipAuthentication;
     $sess->options['timeout'] = $timeout;
     $sess->options['connect_timeout'] = $connect_timeout;
     $sess->options['useragent'] = $user_agent;
     $this->session = $sess;
 }
开发者ID:moip,项目名称:moip-sdk-php,代码行数:22,代码来源:Moip.php

示例8: getProperty

 /**
  * Retrieve system property. Note: Results of this method are
  * cached!
  *
  * Known property names:
  * <pre>
  * php.version       PHP version
  * php.api           PHP api
  * os.name           Operating system name
  * os.tempdir        System-wide temporary directory
  * host.name         Host name
  * host.arch         Host architecture
  * user.home         Current user's home directory
  * user.name         Current user's name
  * file.separator    File separator ("/" on UNIX)
  * path.separator    Path separator (":" on UNIX)
  * </pre>
  *
  * @param   string name
  * @return  var
  */
 public static function getProperty($name)
 {
     static $prop = [];
     if (!isset($prop[$name])) {
         switch ($name) {
             case 'php.version':
                 $prop[$name] = PHP_VERSION;
                 break;
             case 'php.api':
                 $prop[$name] = PHP_SAPI;
                 break;
             case 'os.name':
                 $prop[$name] = PHP_OS;
                 break;
             case 'os.tempdir':
                 $prop[$name] = self::tempDir();
                 break;
             case 'host.name':
                 $prop[$name] = gethostname();
                 break;
             case 'host.arch':
                 if (extension_loaded('posix')) {
                     $uname = posix_uname();
                     $prop[$name] = $uname['machine'];
                     break;
                 }
                 $prop[$name] = self::_env('HOSTTYPE', 'PROCESSOR_ARCHITECTURE');
                 break;
             case 'user.home':
                 if (extension_loaded('posix')) {
                     $pwuid = posix_getpwuid(posix_getuid());
                     $prop[$name] = $pwuid['dir'];
                     break;
                 }
                 $prop[$name] = str_replace('\\', DIRECTORY_SEPARATOR, self::_env('HOME', 'HOMEPATH'));
                 break;
             case 'user.name':
                 $prop[$name] = get_current_user();
                 break;
             case 'file.separator':
                 return DIRECTORY_SEPARATOR;
             case 'path.separator':
                 return PATH_SEPARATOR;
         }
     }
     return $prop[$name];
 }
开发者ID:johannes85,项目名称:core,代码行数:68,代码来源:System.class.php

示例9: u_syslog

function u_syslog($str)
{
    global $_SYSLOG_FD, $_SYSLOG_MODE;
    if (!$_SYSLOG_MODE) {
        u_openlog('unknown');
    }
    if ($_SYSLOG_MODE == 'syslog') {
        syslog(LOG_DEBUG, $s);
        return TRUE;
    } elseif ($_SYSLOG_MODE == 'file') {
        $uname = posix_uname();
        if (fputs($_SYSLOG_FD, date("M d H:i:s") . " " . $uname['nodename'] . " " . $str . "\n")) {
            return TRUE;
        }
    }
    return FALSE;
}
开发者ID:nbtscommunity,项目名称:phpfnlib,代码行数:17,代码来源:syslog.php

示例10: __construct

 /**
  * @private
  */
 private function __construct()
 {
     $system = posix_uname();
     $backtrace = debug_backtrace();
     $starter = array_pop($backtrace);
     unset($backtrace);
     $startFile = isset($starter['file']) ? $starter['file'] : 'Daemon';
     $startFile = $startFile == '-' ? 'Daemon' : $startFile;
     unset($starter);
     $this->fqdn = $system['nodename'];
     $this->hostname = preg_replace('/\\..*/', '', $this->fqdn);
     $this->processName = str_replace(array('.phpt', '.php'), '', $startFile);
     $this->userId = posix_getuid();
     $this->groupId = posix_getgid();
     $this->pid = posix_getpid();
     $this->parentPid = posix_getppid();
     $this->pidPath = sprintf('/var/run/%s', $this->processName);
 }
开发者ID:sgc-fireball,项目名称:libphp,代码行数:21,代码来源:Daemon.php

示例11: getRelease

 /**
  * Returns the distribution
  *
  * @return string string
  */
 public function getRelease()
 {
     switch (strtolower($this->getPlatform())) {
         case "freebsd":
             /**
              * Unfortunately, there's no text file on FreeBSD which tells us the release
              * number. Thus, we hope that "release" within posix_uname() is defined.
              */
             if (function_exists("posix_uname")) {
                 $data = posix_uname();
                 if (array_key_exists("release", $data)) {
                     return $data["release"];
                 }
             }
             break;
         case "darwin":
             /**
              * Mac stores its version number in a public readable plist file, which
              * is in XML format.
              */
             $document = new \DomDocument();
             $document->load("/System/Library/CoreServices/SystemVersion.plist");
             $xpath = new \DOMXPath($document);
             $entries = $xpath->query("/plist/dict/*");
             $previous = "";
             foreach ($entries as $entry) {
                 if (strpos($previous, "ProductVersion") !== false) {
                     return $entry->textContent;
                 }
                 $previous = $entry->textContent;
             }
             break;
         case "linux":
             return $this->getLinuxDistribution();
             break;
         default:
             break;
     }
     return "unknown";
 }
开发者ID:fulcrum3d,项目名称:PartKeepr,代码行数:45,代码来源:OperatingSystem.php

示例12: display

 /**
  * wkhtmltopdf command should be available in the vendor/bin/ folder
  * if composer is used to get the sources from message/wkhtmltopdf in the project vendor/ folder
  * @see \t41\View\Adapter\WebAdapter::display()
  */
 public function display($content = null, $error = false)
 {
     error_reporting(0);
     $html = parent::display($content, $error);
     $unames = posix_uname();
     $ext = $unames['machine'] == 'x86_64' ? 'amd64' : 'i386';
     $bin = Core::$basePath . 'vendor/bin/wkhtmltopdf-' . $ext;
     if (!is_executable($bin)) {
         throw new Exception("Missing or not executable {$bin}");
     }
     if ($this->getParameter('orientation') == PdfAdapter::ORIENTATION_LANDSCAPE) {
         $bin .= ' --orientation Landscape';
     }
     if ($this->getParameter('copies') > 1) {
         $bin .= ' --copies ' . $this->getParameter('copies');
     }
     $dir = '/dev/shm/';
     $key = hash('md5', $html);
     file_put_contents($dir . $key . '.html', $html);
     exec(sprintf("%s %s%s.html %s%s.pdf", $bin, $dir, $key, $dir, $key));
     $doc = $this->getParameter('title') ? str_replace('/', '-', $this->getParameter('title')) . '.pdf' : 'Export.pdf';
     if ($this->getParameter('destination') == 'D') {
         header('Content-Type: application/pdf');
         header('Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
         header('Pragma: public');
         header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
         // Date in the past
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Content-Disposition: inline; filename="' . $doc . '";');
         header('Content-Length: ' . filesize($dir . $key . '.pdf'));
         echo file_get_contents($dir . $key . '.pdf');
         unlink($dir . $key . '.html');
         unlink($dir . $key . '.pdf');
     } else {
         $pdf = file_get_contents($dir . $key . '.pdf');
         unlink($dir . $key . '.html');
         unlink($dir . $key . '.pdf');
         return $pdf;
     }
 }
开发者ID:crapougnax,项目名称:t41,代码行数:45,代码来源:Pdf2Adapter.php

示例13: __construct

 public function __construct($path = null, array $options = [])
 {
     if (!$path) {
         if (!($path = static::$path)) {
             # Check which version we should use based on the current machine architecture
             $bin = "wkhtmltopdf-";
             if (posix_uname()["machine"][0] == "i") {
                 $bin .= "i386";
             } else {
                 $bin .= "amd64";
             }
             # Start in the directory that we are in
             $path = __DIR__;
             # Move up to the composer vendor directory
             $path .= "/../../..";
             # Add the wkhtmltopdf binary path
             $path .= "/h4cc/" . $bin . "/bin/" . $bin;
             static::$path = $path;
         }
     }
     parent::__construct($path, $options);
 }
开发者ID:duncan3dc,项目名称:tcpdf,代码行数:22,代码来源:Snappy.php

示例14: get_hostname

function get_hostname()
{
    static $host = false;
    if ($host === false) {
        if (function_exists("posix_uname")) {
            $uname = posix_uname();
            $host = $uname["nodename"];
        } else {
            if (file_exists("/etc/farmconfig")) {
                $lines = file("/etc/farmconfig");
                foreach ($lines as $line) {
                    $tmp = explode("=", $line);
                    if ($tmp[0] == "HOST") {
                        $host = trim($tmp[1]);
                        break;
                    }
                }
                if ($host === false) {
                    $host = "localhost";
                }
            } else {
                if (file_exists("/etc/hostname")) {
                    $host = file_get_contents("/etc/hostname");
                    $host = trim($host);
                } else {
                    if (file_exists("/etc/HOSTNAME")) {
                        $host = file_get_contents("/etc/HOSTNAME");
                        $host = trim($host);
                    } else {
                        $host = "localhost";
                    }
                }
            }
        }
    }
    return $host;
}
开发者ID:yashodhank,项目名称:serverfarmer,代码行数:37,代码来源:show-hardware.php

示例15: VERIFY

VERIFY(posix_getpgrp());
VERIFY(posix_getpid());
VERIFY(posix_getppid());
$ret = posix_getpwnam("root");
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
VS(posix_getpwnam(""), false);
VS(posix_getpwnam(-1), false);
$ret = posix_getpwuid(0);
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
VS(posix_getpwuid(-1), false);
$ret = posix_getrlimit();
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
VERIFY(posix_getsid(posix_getpid()));
$tmpfifo = tempnam('/tmp', 'vmmkfifotest');
unlink($tmpfifo);
VERIFY(posix_mkfifo($tmpfifo, 0));
$tmpnod = tempnam('/tmp', 'vmmknodtest');
unlink($tmpnod);
VERIFY(posix_mknod($tmpnod, 0));
VERIFY(posix_setpgid(0, 0));
VERIFY(posix_setsid());
VERIFY(strlen(posix_strerror(1)));
$ret = posix_times();
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
$ret = posix_uname();
VERIFY($ret != false);
VERIFY(count((array) $ret) != 0);
开发者ID:gangjun911,项目名称:hhvm,代码行数:31,代码来源:ext_posix.php


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