當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Solar::system方法代碼示例

本文整理匯總了PHP中Solar::system方法的典型用法代碼示例。如果您正苦於以下問題:PHP Solar::system方法的具體用法?PHP Solar::system怎麽用?PHP Solar::system使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Solar的用法示例。


在下文中一共展示了Solar::system方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: start

 /**
  * 
  * Starts Solar: loads configuration values and and sets up the environment.
  * 
  * Note that this method is overloaded; you can pass in different
  * value types for the $config parameter.
  * 
  * * `null|false` -- This will not load any new configuration values;
  *   you will get only the default [[Solar::$config]] array values defined
  *   in the Solar class.
  * 
  * * `string` -- The string is treated as a path to a Solar.config.php
  *   file; the return value from that file will be used for [[Solar_Config::load()]].
  * 
  * * `array` -- This will use the passed array for the [[Solar_Config::load()]]
  *   values.
  * 
  * * `object` -- The passed object will be cast as an array, and those
  *   values will be used for [[Solar_Config::load()]].
  * 
  * Here are some examples of starting with alternative configuration parameters:
  * 
  * {{code: php
  *     require_once 'Solar.php';
  * 
  *     // don't load any config values at all
  *     Solar::start();
  * 
  *     // point to a config file (which returns an array)
  *     Solar::start('/path/to/another/config.php');
  * 
  *     // use an array as the config source
  *     $config = array(
  *         'Solar' => array(
  *             'ini_set' => array(
  *                 'error_reporting' => E_ALL,
  *             ),
  *         ),
  *     );
  *     Solar::start($config);
  * 
  *     // use an object as the config source
  *     $config = new StdClass;
  *     $config->Solar = array(
  *         'ini_set' => array(
  *             'error_reporting' => E_ALL,
  *         ),
  *     );
  *     Solar::start($config);
  * }}
  *  
  * @param mixed $config The configuration source value.
  * 
  * @return void
  * 
  * @see Solar::cleanGlobals()
  * 
  */
 public static function start($config = null)
 {
     // don't re-start if we're already running.
     if (Solar::$_status) {
         return;
     }
     // make sure these classes are loaded
     $list = array('Base', 'Class', 'Config', 'File');
     $dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'Solar';
     foreach ($list as $name) {
         // don't use the autoloader when checking for existence
         if (!class_exists('Solar_' . $name, false)) {
             require $dir . DIRECTORY_SEPARATOR . "{$name}.php";
         }
     }
     // register autoloader
     spl_autoload_register(array('Solar_Class', 'autoload'));
     // clear out registered globals
     if (ini_get('register_globals')) {
         Solar::cleanGlobals();
     }
     // load config values
     Solar_Config::load($config);
     // make sure we have the Solar arch-class configs
     $arch_config = Solar_Config::get('Solar');
     if (!$arch_config) {
         Solar_Config::set('Solar', null, Solar::$_Solar);
     } else {
         Solar_Config::set('Solar', null, array_merge(Solar::$_Solar, (array) $arch_config));
     }
     // set the system directory
     Solar::$system = Solar_Config::get('Solar', 'system');
     // process ini settings from config file
     $settings = Solar_Config::get('Solar', 'ini_set', array());
     foreach ($settings as $key => $val) {
         ini_set($key, $val);
     }
     // user-defined registry entries
     $register = Solar_Config::get('Solar', 'registry_set', array());
     foreach ($register as $name => $list) {
         // make sure we have the class-name and a config
         $list = array_pad((array) $list, 2, null);
//.........這裏部分代碼省略.........
開發者ID:abtris,項目名稱:solarphp-quickstart,代碼行數:101,代碼來源:Solar.php


注:本文中的Solar::system方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。