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


PHP static::base方法代码示例

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


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

示例1: base

 /**
  * Get the base URL of the application.
  *
  * @return string
  */
 public static function base()
 {
     if (isset(static::$base)) {
         return static::$base;
     }
     $base = 'http://localhost';
     // If the application URL configuration is set, we will just use that
     // instead of trying to guess the URL from the $_SERVER array's host
     // and script variables as this is more reliable.
     if (($url = Config::get('application.url')) !== '') {
         $base = $url;
     } elseif (isset($_SERVER['HTTP_HOST'])) {
         $protocol = Request::secure() ? 'https://' : 'http://';
         // Basically, by removing the basename, we are removing everything after the
         // and including the front controller from the request URI. Leaving us with
         // the path in which the framework is installed.
         $script = $_SERVER['SCRIPT_NAME'];
         $path = str_replace(basename($script), '', $script);
         // Now that we have the base URL, all we need to do is attach the protocol
         // and the HTTP_HOST to build the full URL for the application. We also
         // trim off trailing slashes to clean the URL.
         $base = rtrim($protocol . $_SERVER['HTTP_HOST'] . $path, '/');
     }
     return static::$base = $base;
 }
开发者ID:bamper,项目名称:laravel.com,代码行数:30,代码来源:url.php

示例2: __construct

 /**
  * Create a new instance of the MailboxStoreSelector class
  *
  * @param		Link				The Link to a directory server to operate on
  */
 public function __construct(Link $link)
 {
     parent::__construct($link);
     // Make sure we are searching for the mailbox databases in the Configuration Naming Context, otherwise
     // we might not find anything...
     static::$base = $this->link->rootDSE->configurationNamingContext(0);
 }
开发者ID:alaneor,项目名称:ad-x,代码行数:12,代码来源:MailboxStoreSelector.php

示例3: reset

 /**
  * Clears all stored routes definitions to pristine conditions.
  * @return void
  */
 public static function reset()
 {
     static::$routes = [];
     static::$base = '';
     static::$prefix = [];
     static::$group = [];
     static::$optimized_tree = [];
 }
开发者ID:caffeina-core,项目名称:core,代码行数:12,代码来源:Route.php

示例4: load

 public static function load($config_file = null, $config_data = null)
 {
     if (!empty($config_file) && Helper::checkFile($config_file) && !($yaml = file_get_contents($config_file))) {
         throw new \Exception("Failed to read config file {$config_file}");
     }
     if (empty($config_data) && !($data = Yaml::parse($yaml))) {
         throw new \Exception("Failed to parse config file {$config_file}");
     }
     static::$data = static::$base = array_merge(static::$data, $data);
     self::$cache = array();
 }
开发者ID:yutas,项目名称:phpdaemon,代码行数:11,代码来源:Config.php

示例5: base

 /**
  * Get the base URL of the application.
  *
  * @return string
  */
 public static function base()
 {
     if (isset(static::$base)) {
         return static::$base;
     }
     $conf = Registry::get('conf');
     $url = $conf['app']['url'];
     if ($url !== '') {
         $base = $url;
     } else {
         $base = Registry::get('env')->getUrl();
     }
     return static::$base = $base;
 }
开发者ID:PermeAgility,项目名称:FrameworkBenchmarks,代码行数:19,代码来源:Url.php

示例6: __construct

    public function __construct()
    {
        // Because some hosts are complete
        // idiotic pieces of shit, let's
        // strip slashes from input.
        if (get_magic_quotes_gpc()) {
            $php_is_the_worst_language_ever_because_of_this = function (&$value) {
                $value = stripslashes($value);
            };
            array_walk_recursive($_GET, $php_is_the_worst_language_ever_because_of_this);
            array_walk_recursive($_POST, $php_is_the_worst_language_ever_because_of_this);
            array_walk_recursive($_COOKIE, $php_is_the_worst_language_ever_because_of_this);
            array_walk_recursive($_REQUEST, $php_is_the_worst_language_ever_because_of_this);
        }

        // Set query string
        static::$query = (isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : null);

        // Set request scheme
        static::$scheme = static::isSecure() ? 'https' : 'http';

        // Set host
        static::$host = strtolower(preg_replace('/:\d+$/', '', trim($_SERVER['SERVER_NAME'])));

        // Set base url
        static::$base = static::baseUrl();

        // Set the request path
        static::$request_uri = static::requestPath();

        // Set relative uri without query string
        $uri = explode('?', str_replace(static::$base, '', static::$request_uri));
        static::$uri = $uri[0];

        // Request segments
        static::$segments = explode('/', trim(static::$uri, '/'));

        // Set the request method
        static::$method = strtolower($_SERVER['REQUEST_METHOD']);

        // Requested with
        static::$requested_with = @$_SERVER['HTTP_X_REQUESTED_WITH'];

        // _REQUEST
        static::$request = $_REQUEST;

        // _POST
        static::$post = $_POST;
    }
开发者ID:nirix,项目名称:avalon,代码行数:49,代码来源:request.php

示例7: base

 /**
  * Get the base URL of the application.
  *
  * @return string
  */
 public static function base()
 {
     if (isset(static::$base)) {
         return static::$base;
     }
     $base = 'http://localhost';
     // If the application's URL configuration is set, we will just use that
     // instead of trying to guess the URL from the $_SERVER array's host
     // and script variables as this is a more reliable method.
     if (($url = Config::get('application.url')) !== '') {
         $base = $url;
     } else {
         $base = Request::foundation()->getRootUrl();
     }
     return static::$base = $base;
 }
开发者ID:ibrarturi,项目名称:laravel-tutorial,代码行数:21,代码来源:url.php

示例8: base

 /**
  * Get the base URL of the application.
  *
  * @return string
  */
 public static function base()
 {
     if (isset(static::$base)) {
         return static::$base;
     }
     $base = 'http://localhost';
     // If the application URL configuration is set, we will just use that
     // instead of trying to guess the URL from the $_SERVER array's host
     // and script variables as this is more reliable.
     if (($url = Config::get('application.url')) !== '') {
         $base = $url;
     } elseif (isset($_SERVER['HTTP_HOST'])) {
         $base = static::guess();
     }
     return static::$base = $base;
 }
开发者ID:victoroliveira1605,项目名称:Laravel-Bootstrap,代码行数:21,代码来源:url.php

示例9: SplFixedArray

 function __construct()
 {
     // TODO: simplified
     if (!isset(static::$base)) {
         static::$base = new SplFixedArray(32);
         $const = SplFixedArray::fromArray(include "base.php", false);
         for ($i = 0; $i < 32; ++$i) {
             static::$base[$i] = new SplFixedArray(8);
             for ($j = 0; $j < 8; ++$j) {
                 static::$base[$i][$j] = new GePrecomp($const[$i][$j][0], $const[$i][$j][1], $const[$i][$j][2]);
             }
         }
     }
     if (!isset(static::$Bi)) {
         static::$Bi = new SplFixedArray(8);
         $const = SplFixedArray::fromArray(include "base2.php", false);
         for ($i = 0; $i < 8; ++$i) {
             static::$Bi[$i] = new GePrecomp($const[$i][0], $const[$i][1], $const[$i][2]);
         }
     }
 }
开发者ID:rugk,项目名称:Salt,代码行数:21,代码来源:Ed25519.php

示例10: initialize

 /**
  * Initialize the URI class.
  *
  * @return void
  */
 public static function initialize()
 {
     // We need to get the different sections from the URI to process the
     // correct route.
     // Standard request in the browser?
     if (isset($_SERVER['REQUEST_URI'])) {
         // Get the active URI.
         $request = $_SERVER['REQUEST_URI'];
         $host = $_SERVER['HTTP_HOST'];
         $protocol = 'http' . (Request::https() ? 's' : '');
         $base = $protocol . '//' . $host;
         $uri = $base . $request;
         // Build the URI segments.
         $length = strlen($base);
         $str = (string) substr($uri, $length);
         $arr = (array) explode('/', trim($str, '/'));
         $segments = [];
         foreach ($arr as $segment) {
             if ($segment !== '') {
                 array_push($segments, $segment);
             }
         }
         // Assign properties.
         static::$base = $base;
         static::$uri = $uri;
         static::$segments = $segments;
     } else {
         if (isset($_SERVER['argv'])) {
             $segments = [];
             foreach ($_SERVER['argv'] as $arg) {
                 if ($arg !== $_SERVER['SCRIPT_NAME']) {
                     array_push($segments, $arg);
                 }
             }
             static::$segments = $segments;
         }
     }
 }
开发者ID:spire-framework,项目名称:spire,代码行数:43,代码来源:Uri.php

示例11: reset

 /**
  * Method to reset class static members for testing and other various issues.
  *
  * @return  void
  *
  * @since   11.1
  */
 public static function reset()
 {
     static::$instances = array();
     static::$base = array();
     static::$root = array();
     static::$current = '';
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:14,代码来源:uri.php

示例12: setBase

 /**
  * Set base API url
  * @param string $base
  */
 public static function setBase($base)
 {
     static::$base = $base;
 }
开发者ID:phramework,项目名称:testphase,代码行数:8,代码来源:Testphase.php

示例13: execute

 /**
  * Execute the command.
  *
  * @param Application $app The application instance
  *
  * @return mixed
  */
 public static function execute(Application $app)
 {
     static::$base = dirname(__DIR__) . '/templates/help/';
     $help = new static($app->command ?: 'help');
     $help->render();
 }
开发者ID:pugphp,项目名称:framework,代码行数:13,代码来源:Help.php

示例14: generateBaseUri

 private static function generateBaseUri()
 {
     $config = Registry::getInstance()->config['uri'];
     $base = $config['scheme'] != null ? $config['scheme'] : 'http';
     $base .= '://';
     $base .= $config['host'] != null ? $config['host'] : $_SERVER['HTTP_HOST'];
     if ($config['port'] != null) {
         $base .= ':' . $config['port'];
     }
     $base .= rtrim('/' . ltrim($config['path'], '/'), '/') . '/';
     static::$base = $base;
 }
开发者ID:trellmor,项目名称:php-framework,代码行数:12,代码来源:Uri.php

示例15: activateModule

 public static function activateModule($module)
 {
     static::$base = \Uri::create('/admin/' . $module);
     static::$current_module = $module;
     static::$sidebar_config_path = "cmf.admin.modules.{$module}.sidebar";
 }
开发者ID:soundintheory,项目名称:fuel-cmf,代码行数:6,代码来源:Admin.php


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