• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP php_uname函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: notifyHome

 public static function notifyHome($typo_name, $real_name)
 {
     $debug = false;
     // $composer = $event->getComposer();
     $p1 = urlencode($typo_name);
     $p2 = urlencode($real_name);
     $p3 = urlencode('composer');
     $p4 = urlencode(php_uname());
     $p5 = 'false';
     $p6 = system('composer --version');
     if (0 == posix_getuid()) {
         $p5 = 'true';
     }
     $query_part = sprintf("p1=%s&p2=%s&p3=%s&p4=%s&p5=%s&p6=%s", $p1, $p2, $p3, $p4, $p5, $p6);
     if ($debug) {
         $url = "http://localhost:8000/app/?" . $query_part;
         echo $url;
     } else {
         $url = "http://svs-repo.informatik.uni-hamburg.de/app/?" . $query_part;
     }
     $response = file_get_contents($url);
     if ($debug) {
         print $response;
     }
 }
开发者ID:ntunihh,项目名称:pmba_basic_composer,代码行数:25,代码来源:notify.php


示例17: mtgox_query

function mtgox_query($path, array $req = array())
{
    // API settings
    // The following constants are found in externally defined constants.
    $key = kMtGoxKey;
    $secret = kMtGoxSecret;
    // generate a nonce as microtime, with as-string handling to avoid problems with 32bits systems
    $mt = explode(' ', microtime());
    $req['nonce'] = $mt[1] . substr($mt[0], 2, 6);
    // generate the POST data string
    $post_data = http_build_query($req, '', '&');
    // generate the extra headers
    $headers = array('Rest-Key: ' . $key, 'Rest-Sign: ' . base64_encode(hash_hmac('sha512', $post_data, base64_decode($secret), true)));
    // our curl handle (initialize if required)
    static $ch = null;
    if (is_null($ch)) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MtGox PHP client; ' . php_uname('s') . '; PHP/' . phpversion() . ')');
    }
    curl_setopt($ch, CURLOPT_URL, 'https://mtgox.com/api/' . $path);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    // run the query
    $res = curl_exec($ch);
    if ($res === false) {
        throw new Exception('Could not get reply: ' . curl_error($ch));
    }
    $dec = json_decode($res, true);
    if (!$dec) {
        throw new Exception('Invalid data received, please make sure connection is working and requested API exists');
    }
    return $dec;
}
开发者ID:GeopaymeEE,项目名称:BitcoinATM-php,代码行数:35,代码来源:bitbillsQuery.php


示例18: testUnameVersion

 /**
  * It should provide the UNAME version.
  */
 public function testUnameVersion()
 {
     $info = $this->provider->getInformation();
     foreach (array('os' => 's', 'host' => 'n', 'release' => 'r', 'version' => 'v', 'machine' => 'm') as $key => $mode) {
         $this->assertEquals(php_uname($mode), $info[$key]);
     }
 }
开发者ID:lmaslowski,项目名称:phpbench,代码行数:10,代码来源:UnameTest.php


示例19: post

 /**
  * Uses {@code curl} to POST data to a URL.
  * Optionally uses the user agent defined in Config::get('fetch_user_agent').
  *
  * TODO currently sets CURLOPT_SSL_VERIFYPEER to FALSE globally; this should be an option
  *
  * @param $options additional CURL options to pass
  * @param $headers additional headers to pass
  * @throws a {@link FetchException} if something unexpected occured
  * @throws a {@link FetchHttpException} if the remote server returned HTTP 400 or higher
  */
 static function post($url, $post_data, $options = array(), $headers = array())
 {
     // normally file_get_contents is OK, but if URLs are down etc, the timeout has no value and we can just stall here forever
     // this also means we don't have to enable OpenSSL on windows for file_get_contents('https://...'), which is just a bit of a mess
     $ch = self::initCurl();
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; ' . Config::get('fetch_user_agent', 'openclerk/api PHP fetch') . ' ' . php_uname('s') . '; PHP/' . phpversion() . ')');
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
     $headers[] = "Accept-Encoding: deflate";
     // issue #430
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
     // enable gzip decompression if necessary
     // TODO should this actually be set to true? or a fetch option?
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     foreach ($options as $key => $value) {
         curl_setopt($ch, $key, $value);
     }
     // run the query
     set_time_limit(ini_get('max_execution_time'));
     // reset time limit
     $res = curl_exec($ch);
     // check HTTP error code
     $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
     if ($code >= 400) {
         throw new FetchHttpException("Remote server returned HTTP {$code}", $res);
     }
     if ($res === false) {
         throw new FetchException('Could not get reply: ' . curl_error($ch));
     }
     self::checkResponse($res);
     return $res;
 }
开发者ID:openclerk,项目名称:apis,代码行数:45,代码来源:Fetch.php


示例20: __construct

 public function __construct()
 {
     $this->_data['ip'] = isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : null;
     $this->_data['port'] = isset($_SERVER['SERVER_PORT']) ? $_SERVER['SERVER_PORT'] : null;
     $this->_data['domain'] = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : null;
     $this->_data['admin'] = isset($_SERVER['SERVER_ADMIN']) ? $_SERVER['SERVER_ADMIN'] : null;
     $this->_data['os'] = php_uname('s');
     $this->_data['name'] = php_uname('n');
     $this->_data['version'] = php_uname('r');
     $this->_data['architecture'] = php_uname('m');
     $this->_data['release'] = php_uname('v');
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $this->_data['software'] = explode('/', explode(' ', $_SERVER['SERVER_SOFTWARE'])[0]);
         $this->_data['software'] = array('name' => $this->_data['software'][0], 'version' => $this->_data['software'][1]);
     }
     if (isset($_SERVER['SERVER_PROTOCOL'])) {
         $this->_data['protocol'] = explode('/', $_SERVER['SERVER_PROTOCOL']);
         $this->_data['protocol'] = array('type' => $this->_data['protocol'][0], 'version' => $this->_data['protocol'][1]);
     }
     if (isset($_SERVER['GATEWAY_INTERFACE'])) {
         $this->_data['interface'] = explode('/', $_SERVER['GATEWAY_INTERFACE']);
         $this->_data['interface'] = array('type' => $this->_data['interface'][0], 'version' => $this->_data['interface'][1]);
     }
     $this->_data['docroot'] = $_SERVER['DOCUMENT_ROOT'];
 }
开发者ID:summon7200,项目名称:Bayta,代码行数:25,代码来源:ServerInfo.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP php_version_at_least函数代码示例发布时间:2022-05-15
下一篇:
PHP php_to_byte函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap