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


PHP php_uname函数代码示例

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


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

示例1: index

 public function index()
 {
     $os = explode(' ', php_uname());
     $mysql_support = function_exists('mysql_close') ? '<font color="green">√</font>' : '<font color="red">×</font>';
     $register_globals = get_cfg_var("register_globals") ? '<font color="green">√</font>' : '<font color="red">×</font>';
     $enable_dl = get_cfg_var("enable_dl") ? '<font color="green">√</font>' : '<font color="red">×</font>';
     $allow_url_fopen = get_cfg_var("allow_url_fopen") ? '<font color="green">√</font>' : '<font color="red">×</font>';
     $display_errors = get_cfg_var("display_errors") ? '<font color="green">√</font>' : '<font color="red">×</font>';
     $session_support = function_exists('session_start') ? '<font color="green">√</font>' : '<font color="red">×</font>';
     $config['server_name'] = $_SERVER['SERVER_NAME'];
     $config['server_ip'] = @gethostbyname($_SERVER['SERVER_NAME']);
     $config['server_time'] = date("Y年n月j日 H:i:s");
     $config['os'] = $os[0];
     $config['os_core'] = $os[2];
     $config['server_root'] = dirname(dirname($_SERVER['SCRIPT_FILENAME']));
     $config['server_engine'] = $_SERVER['SERVER_SOFTWARE'];
     $config['server_port'] = $_SERVER['SERVER_PORT'];
     $config['php_version'] = PHP_VERSION;
     $config['php_run_type'] = strtoupper(php_sapi_name());
     $config['mysql_support'] = $mysql_support;
     $config['register_globals'] = $register_globals;
     $config['allow_url_fopen'] = $allow_url_fopen;
     $config['display_errors'] = $display_errors;
     $config['enable_dl'] = $enable_dl;
     $config['memory_limit'] = get_cfg_var("memory_limit");
     $config['post_max_size'] = get_cfg_var("post_max_size");
     $config['upload_max_filesize'] = get_cfg_var("upload_max_filesize");
     $config['max_execution_time'] = get_cfg_var("max_execution_time");
     $config['session_support'] = $session_support;
     $this->config_arr = $config;
     $this->display();
 }
开发者ID:redisck,项目名称:xiangmu,代码行数:32,代码来源:ConfigAction.class.php

示例2: _load_protection

/**
 * 服务器负载保护函数,本方法目前不支持window系统
 *
 * 最大负载不要超过3*N核,例如有16核(含8核超线程)则 16*3=48
 *
 * @see http://php.net/manual/en/function.sys-getloadavg.php
 */
function _load_protection($max_load_avg = 24)
{
    global $dir_log, $dir_wwwroot;
    if (!function_exists('sys_getloadavg')) {
        return false;
    }
    $load = sys_getloadavg();
    if (!isset($load[0])) {
        return false;
    }
    if ($load[0] <= $max_load_avg) {
        // 未超过负载,则跳出
        return false;
    }
    $msg_tpl = "[%s] HOST:%s LOAD:%s ARGV/URI:%s\n";
    $time = @date(DATE_RFC2822);
    $host = php_uname('n');
    $load = sprintf('%.2f', $load[0]);
    if (php_sapi_name() == "cli" || empty($_SERVER['PHP_SELF'])) {
        $argv_or_uri = implode(',', $argv);
    } else {
        $argv_or_uri = $_SERVER['REQUEST_URI'];
    }
    $msg = sprintf($msg_tpl, $time, $host, $load, $argv_or_uri);
    if (@is_dir($dir_log)) {
        @file_put_contents($dir_log . "php-server-overload.log", $msg, FILE_APPEND);
    }
    # exit with 500 page
    header("HTTP/1.1 500 Internal Server Error");
    header("Expires: " . gmdate("D, d M Y H:i:s", time() - 99999) . " GMT");
    header("Cache-Control: private");
    header("Pragma: no-cache");
    exit(file_get_contents($dir_wwwroot . 'errors/server_overload.html'));
}
开发者ID:google2013,项目名称:myqeecms,代码行数:41,代码来源:index.php

示例3: defaultMailer

	/**
	 * Default mailer.
	 * @param  string
	 * @param  string
	 * @return void
	 */
	public static function defaultMailer($message, $email)
	{
		$host = php_uname('n');
		foreach (array('HTTP_HOST','SERVER_NAME', 'HOSTNAME') as $item) {
			if (isset($_SERVER[$item])) {
				$host = $_SERVER[$item]; break;
			}
		}

		$parts = str_replace(
			array("\r\n", "\n"),
			array("\n", PHP_EOL),
			array(
				'headers' => implode("\n", array(
					"From: noreply@$host",
					'X-Mailer: Nette Framework',
					'Content-Type: text/plain; charset=UTF-8',
					'Content-Transfer-Encoding: 8bit',
				)) . "\n",
				'subject' => "PHP: An error occurred on the server $host",
				'body' => "[" . @date('Y-m-d H:i:s') . "] $message", // @ - timezone may not be set
			)
		);

		mail($email, $parts['subject'], $parts['body'], $parts['headers']);
	}
开发者ID:krecek,项目名称:nrsn,代码行数:32,代码来源:Logger.php

示例4: __construct

 function __construct($file, $width, $height, $mode = auto, $format = 'png')
 {
     $is_Windows = strtoupper(substr(php_uname('s'), 0, 3)) == 'WIN';
     $slash = $is_Windows ? '\\' : '/';
     $this->info = getimagesize($file);
     if (!is_array($this->info)) {
         return;
     }
     $this->src = $this->open($file);
     // echo '<pre>';
     // var_export($this->info);
     // echo '</pre>';
     $this->options = get_option('wpUI_options');
     if (!isset($this->options) || !isset($this->options['enable_cache'])) {
         return;
     }
     $this->width = imagesx($this->src);
     $this->height = imagesy($this->src);
     if ($this->width / $this->height != 1) {
         $mode = 'crop';
     }
     $filestr = md5(str_replace($slash, '', strrchr($file, $slash)) . '_' . $width . '_' . $height . '_' . $mode);
     $cachedir = wpui_adjust_path(WP_CONTENT_DIR . '/uploads/wp-ui/cache/');
     is_dir($cachedir) || @mkdir($cachedir, 0755, true);
     $storestr = $cachedir . $filestr . '.' . $format;
     if (file_exists($storestr)) {
         $this->output($storestr, $format);
     } else {
         $this->resize($width, $height, $mode);
         $this->save($storestr, 100, $format);
         $this->output($storestr, $format);
     }
 }
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:33,代码来源:class-imager.php

示例5: getHostname

 /**
  * @return string
  */
 public static function getHostname()
 {
     if (!isset(self::$hostname)) {
         self::$hostname = gethostname() ?: php_uname('n');
     }
     return self::$hostname;
 }
开发者ID:spryker,项目名称:Library,代码行数:10,代码来源:System.php

示例6: __construct

 function __construct()
 {
     $this->S['YourIP'] = @$_SERVER['REMOTE_ADDR'];
     $domain = $this->OS() ? $_SERVER['SERVER_ADDR'] : @gethostbyname($_SERVER['SERVER_NAME']);
     $this->S['DomainIP'] = @get_current_user() . ' - ' . $_SERVER['SERVER_NAME'] . '(' . $domain . ')';
     $this->S['Flag'] = empty($this->sysInfo['win_n']) ? @php_uname() : $this->sysInfo['win_n'];
     $os = explode(" ", php_uname());
     $oskernel = $this->OS() ? $os[2] : $os[1];
     $this->S['OS'] = $os[0] . '内核版本:' . $oskernel;
     $this->S['Language'] = getenv("HTTP_ACCEPT_LANGUAGE");
     $this->S['Name'] = $this->OS() ? $os[1] : $os[2];
     $this->S['Email'] = $_SERVER['SERVER_ADMIN'];
     $this->S['WebEngine'] = $_SERVER['SERVER_SOFTWARE'];
     $this->S['WebPort'] = $_SERVER['SERVER_PORT'];
     $this->S['WebPath'] = $_SERVER['DOCUMENT_ROOT'] ? str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']) : str_replace('\\', '/', dirname(__FILE__));
     $this->S['ProbePath'] = str_replace('\\', '/', __FILE__) ? str_replace('\\', '/', __FILE__) : $_SERVER['SCRIPT_FILENAME'];
     $this->S['sTime'] = date('Y-m-d H:i:s');
     $this->sysInfo = $this->GetsysInfo();
     //var_dump($this->sysInfo);
     $CPU1 = $this->GetCPUUse();
     sleep(1);
     $CPU2 = $this->GetCPUUse();
     $data = $this->GetCPUPercent($CPU1, $CPU2);
     $this->CPU_Use = $data['cpu0']['user'] . "%us,  " . $data['cpu0']['sys'] . "%sy,  " . $data['cpu0']['nice'] . "%ni, " . $data['cpu0']['idle'] . "%id,  " . $data['cpu0']['iowait'] . "%wa,  " . $data['cpu0']['irq'] . "%irq,  " . $data['cpu0']['softirq'] . "%softirq";
     if (!$this->OS()) {
         $this->CPU_Use = '目前只支持Linux系统';
     }
     $this->hd = $this->GetDisk();
     $this->NetWork = $this->GetNetWork();
 }
开发者ID:sunxfancy,项目名称:Questionnaire,代码行数:30,代码来源:check.php

示例7: getApi

 /**
  * Fetch JSON data from an API
  * @param url string API URL
  * @param target string API method
  * @param auth array Optional authentication data to be sent with
  * @return dec array JSON decoded PHP array
  **/
 public function getApi($url, $target, $auth = NULL)
 {
     static $ch = null;
     static $ch = null;
     if (is_null($ch)) {
         $ch = curl_init();
         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
         curl_setopt($ch, CURLOPT_TIMEOUT, 30);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; PHP client; ' . php_uname('s') . '; PHP/' . phpversion() . ')');
     }
     curl_setopt($ch, CURLOPT_URL, $url . $target);
     // curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     // run the query
     $res = curl_exec($ch);
     if ($res === false) {
         $this->setErrorMessage('Could not get reply: ' . curl_error($ch));
         return false;
     }
     $dec = json_decode($res, true);
     if (!$dec) {
         $this->setErrorMessage('Invalid data received, please make sure connection is working and requested API exists');
         return false;
     }
     return $dec;
 }
开发者ID:ed-ro0t,项目名称:php-mpos,代码行数:34,代码来源:tools.class.php

示例8: setUp

 protected function setUp()
 {
     $uname = php_uname('s');
     if (substr($uname, 0, 7) == 'Windows') {
         $this->markTestSkipped('Unix tests');
     }
 }
开发者ID:andikoller,项目名称:FHC-3.0-FHBGLD,代码行数:7,代码来源:features_test.php

示例9: renderPanel

 public function renderPanel()
 {
     $data = $this->getData();
     $sections = array('Basics' => array('Machine' => php_uname('n')));
     // NOTE: This may not be present for some SAPIs, like php-fpm.
     if (!empty($data['Server']['SERVER_ADDR'])) {
         $addr = $data['Server']['SERVER_ADDR'];
         $sections['Basics']['Host'] = $addr;
         $sections['Basics']['Hostname'] = @gethostbyaddr($addr);
     }
     $sections = array_merge($sections, $data);
     $mask = array('HTTP_COOKIE' => true, 'HTTP_X_PHABRICATOR_CSRF' => true);
     $out = array();
     foreach ($sections as $header => $map) {
         $rows = array();
         foreach ($map as $key => $value) {
             if (isset($mask[$key])) {
                 $rows[] = array($key, phutil_tag('em', array(), '(Masked)'));
             } else {
                 $rows[] = array($key, is_array($value) ? json_encode($value) : $value);
             }
         }
         $table = new AphrontTableView($rows);
         $table->setHeaders(array($header, null));
         $table->setColumnClasses(array('header', 'wide wrap'));
         $out[] = $table->render();
     }
     return phutil_implode_html("\n", $out);
 }
开发者ID:denghp,项目名称:phabricator,代码行数:29,代码来源:DarkConsoleRequestPlugin.php

示例10: clientUserAgent

 public static function clientUserAgent()
 {
     $langVersion = phpversion();
     $uname = php_uname();
     $userAgent = array('bindings_version' => Castle::VERSION, 'lang' => 'php', 'lang_version' => $langVersion, 'platform' => PHP_OS, 'publisher' => 'castle', 'uname' => $uname);
     return json_encode($userAgent);
 }
开发者ID:castle,项目名称:castle-php,代码行数:7,代码来源:Request.php

示例11: __construct

 public function __construct()
 {
     chdir(dirname(__DIR__));
     foreach ($this->binaries as $name => $path) {
         if (getenv(strtoupper("ion_{$name}_exec"))) {
             $this->binaries[$name] = getenv(strtoupper("ion_{$name}_exec"));
         }
     }
     set_exception_handler(function (\Throwable $exception) {
         $this->line(get_class($exception) . ": " . $exception->getMessage() . " in " . $exception->getFile() . ":" . $exception->getLine() . "\n" . $exception->getTraceAsString() . "\n");
         exit(1);
     });
     if ($this->isMacOS()) {
         if (fnmatch('1*.*.*', php_uname("r"))) {
             $this->cflags[] = "-arch x86_64 -mmacosx-version-min=10.5";
         } else {
             $this->cflags[] = "-arch x86_64 -arch ppc -arch ppc64";
         }
     }
     if ($this->isLinux()) {
         $this->nproc = intval(`nproc`) - 1;
     } elseif ($this->isMacOS() || $this->isBSD()) {
         $this->nproc = intval(`sysctl -n hw.ncpu`) - 1;
     }
     if ($this->nproc < 1) {
         $this->nproc = 1;
     }
     if (!PHP_ZTS) {
         //            $this->event_confugure[] = "--disable-thread-support";
     }
 }
开发者ID:php-ion,项目名称:php-ion,代码行数:31,代码来源:ionizer.php

示例12: macro_SystemInfo

function macro_SystemInfo($formatter, $value = '')
{
    global $_revision, $_release;
    // hide some system information from version string
    $version = phpversion();
    if (empty($DBInfo->showall_systeminfo)) {
        $version = preg_replace('@^([0-9.]+).*$@', '$1', $version);
    }
    $version = preg_replace('/(\\.\\d+)$/', '.x', $version);
    $tmp = explode(' ', php_uname());
    $uname = ' (' . $tmp[0] . ' ' . $tmp[2] . ' ' . $tmp[4] . ')';
    list($aversion, $dummy) = explode(" ", $_SERVER['SERVER_SOFTWARE'], 2);
    $pages = macro_PageCount($formatter);
    $npage = _("Number of Pages");
    $ver_serv = _("HTTP Server Version");
    $ver_moni = _("MoniWiki Version");
    $ver_php = _("PHP Version");
    return <<<EOF
<table border='0' cellpadding='5'>
<tr><th width='200'>{$ver_php}</th> <td>{$version}{$uname}</td></tr>
<tr><th>{$ver_moni}</th> <td>Release {$_release} [{$_revision}]</td></tr>
<tr><th>{$ver_serv}</th> <td>{$aversion}</td></tr>
<tr><th>{$npage}</th> <td>{$pages}</td></tr>
</table>
EOF;
}
开发者ID:ahastudio,项目名称:moniwiki,代码行数:26,代码来源:SystemInfo.php

示例13: payready_get_url

function payready_get_url($url, $post = '')
{
    if (extension_loaded("curl")) {
        $ch = curl_init($url);
        curl_setopt($ch, CURLOPT_HEADER, 0);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $buffer = curl_exec($ch);
        curl_close($ch);
        return $buffer;
    } else {
        global $config;
        if (substr(php_uname(), 0, 7) == "Windows") {
            $curl = $config['curl'];
            if (!strlen($curl)) {
                fatal_error("cURL path is not set");
            }
        } else {
            $curl = escapeshellcmd($config['curl']);
            if (!strlen($curl)) {
                fatal_error("cURL path is not set");
            }
            //            $post = escapeshellcmd($post);
            $url = escapeshellcmd($url);
        }
        $ret = `{$curl} -d "{$post}" {$url}`;
        return $ret;
    }
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:29,代码来源:pay.inc.php

示例14: getDistributionInstance

 public function getDistributionInstance() : LinuxContract
 {
     $match = [];
     preg_match('/.*-(\\w*)/i', strtolower(php_uname('r')), $match);
     /*
      * Using a custom kernel on Arch? uname may not have Arch identifier.
      * Check /etc/issue as a fallback.
      */
     if (is_file('/etc/issue') && $match != 'ubuntu' && $match != 'manjaro') {
         // get contents of /etc/issue into a string
         $filename = '/etc/issue';
         $handle = fopen($filename, 'r');
         $contents = fread($handle, filesize($filename));
         fclose($handle);
         if (preg_match('/^Arch/', $contents) == true) {
             $match[1] = 'arch';
         }
     }
     switch ($match[1]) {
         case 'manjaro':
         case 'arch':
             return new Arch($this->cli, $this->files);
         default:
             return new Ubuntu($this->cli, $this->files);
     }
 }
开发者ID:jmarcher,项目名称:valet-linux,代码行数:26,代码来源:Linux.php

示例15: execute

 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     parent::execute($input, $output);
     $this->writeCommandHeader($output, 'Current mail configuration.');
     $path = $this->getHelper('configuration')->getConfigurationPath();
     $path .= 'mail.conf.php';
     define('IS_WINDOWS_OS', strtolower(substr(php_uname(), 0, 3)) == 'win' ? true : false);
     if (isset($path) && is_file($path)) {
         $output->writeln('File: ' . $path);
         $lines = file($path);
         $list = array('SMTP_HOST', 'SMTP_PORT', 'SMTP_MAILER', 'SMTP_AUTH', 'SMTP_USER', 'SMTP_PASS');
         foreach ($lines as $line) {
             $match = array();
             if (preg_match("/platform_email\\['(.*)'\\]/", $line, $match)) {
                 if (in_array($match[1], $list)) {
                     eval($line);
                 }
             }
         }
         $output->writeln('Host:     ' . $platform_email['SMTP_HOST']);
         $output->writeln('Port:     ' . $platform_email['SMTP_PORT']);
         $output->writeln('Mailer:   ' . $platform_email['SMTP_MAILER']);
         $output->writeln('Auth SMTP:' . $platform_email['SMTP_AUTH']);
         $output->writeln('User:     ' . $platform_email['SMTP_USER']);
         $output->writeln('Pass:     ' . $platform_email['SMTP_PASS']);
     } else {
         $output->writeln("<comment>Nothing to print</comment>");
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:34,代码来源:MailConfCommand.php


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