當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。