当前位置: 首页>>代码示例>>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;未经允许,请勿转载。