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


PHP request::isSecure方法代码示例

本文整理汇总了PHP中request::isSecure方法的典型用法代码示例。如果您正苦于以下问题:PHP request::isSecure方法的具体用法?PHP request::isSecure怎么用?PHP request::isSecure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在request的用法示例。


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

示例1: get

 function get($email, $size = null)
 {
     $default = config::get('lepton.avatars.gravatars.default', 'identicon');
     if (!$size) {
         $size = config::get('lepton.avatars.defaultsize', 64);
     }
     return (request::isSecure() ? 'https://secure.gravatar.com' : 'http://www.gravatar.com') . "/avatar.php?" . "gravatar_id=" . md5(strtolower($email)) . "&default=" . urlencode($default) . "&size=" . $size;
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:8,代码来源:avatars.php

示例2: __construct

 /**
  * Constructor
  *
  * @param string $uri The URI to route
  * @param string $domain The domain to route
  * @param bool $secure True if connection made via SSL
  */
 public function __construct($buri = '/')
 {
     if (isset($_SERVER['REQUEST_URI'])) {
         $uri = $_SERVER['REQUEST_URI'];
     } else {
         $uri = $buri;
     }
     if (isset($_SERVER['HTTP_HOST'])) {
         $domain = strtolower($_SERVER['HTTP_HOST']);
     } else {
         if (isset($_SERVER['SERVER_NAME'])) {
             $domain = strtolower($_SERVER['SERVER_NAME']);
         } else {
             $domain = 'localhost';
         }
     }
     $secure = true;
     // Parse query string
     if (strpos($uri, '?')) {
         $base = substr($uri, 0, strpos($uri, '?'));
         $rest = substr($uri, strpos($uri, '?') + 1);
         // Apache mod_rewrite workaround for existing folders - requests
         // are routed as /uri/?/uri if the folder exists.
         if ($base != '/' && file_exists('.' . $base) && substr($rest, 0, strlen($base) - 1) . '/' == $base) {
             // folder match, reroute the $rest.
             // TODO: Query string arguments should be passed on
             if (strpos($rest, '&') > 0) {
                 $params = substr($rest, strpos($rest, '&') + 1);
             }
             response::redirect($base . '?' . $params);
         } else {
             // Parse the querystring
             $qsl = explode('&', $rest);
             foreach ($qsl as $qsi) {
                 if (preg_match('/^(.*)=(.*)$/', $qsi, $keys)) {
                     $_GET[$keys[1]] = urldecode($keys[2]);
                     $_REQUEST[$keys[1]] = urldecode($keys[2]);
                 }
             }
             $uri = $base;
         }
     }
     // Quick fix for first index being '/index_php' when invoked via
     // apache - hopefully sorts bug with php oauth.
     if (arr::hasKey($_GET, '/index_php')) {
         array_shift($_GET);
         array_shift($_GET);
     }
     // Assign the URI and start parsing
     $this->_uri = $uri;
     $this->_domain = $domain;
     $this->_secure = request::isSecure();
     foreach (explode('/', $this->_uri) as $segment) {
         if ($segment != '') {
             $this->_urisegments[] = $segment;
         }
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:65,代码来源:router.php

示例3: getURL

 /**
  * @brief Get the full query URL
  * 
  * @return string The full query URL
  */
 static function getURL()
 {
     if (isset($_SERVER['HTTP_HOST'])) {
         if (request::isSecure()) {
             $proto = 'https://';
             $port = intval($_SERVER['SERVER_PORT']) != 443 ? ':' . $_SERVER['SERVER_PORT'] : '';
         } else {
             $proto = 'http://';
             $port = intval($_SERVER['SERVER_PORT']) != 80 ? ':' . $_SERVER['SERVER_PORT'] : '';
         }
         if (arr::hasKey($_SERVER, 'REQUEST_URI')) {
             $uri = $_SERVER['REQUEST_URI'];
         } else {
             if (arr::hasKey($_SERVER, 'REQUEST_URL')) {
                 $uri = $_SERVER['REQUEST_URL'];
                 $querystring = request::getRawQueryString();
                 $uri .= $querystring;
             }
         }
         return $proto . $_SERVER['HTTP_HOST'] . $port . $uri;
     } else {
         return null;
     }
 }
开发者ID:noccy80,项目名称:lepton-ng,代码行数:29,代码来源:request.php


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