} } break; } } } if (!$init_complete) { throw new InvalidValueException('this domain is not config in store service, you must config it in admin store config'); } } /** * @param $store_code | String * @param $store | Array * mobile device url redirect. * pc端自动跳转到html5端的检测 */
// 初始化的bootstrap public function bootstrap($app) { if ($this->appName == 'appadmin') { Yii::$service->admin->bootstrap($app); } else { Yii::$service->store->bootstrap($app); } } // 得到配置值 /** * @param $key | string, 配置的主Key * @param $subKey | string, 配置的子key
if (!isset($component)) { $component = Yii::createObject($mixed); } if ($component instanceof BootstrapInterface) { Yii::debug('Bootstrap with ' . get_class($component) . '::bootstrap()', __METHOD__); $component->bootstrap($this); } else { Yii::debug('Bootstrap with ' . get_class($component), __METHOD__); } } }
protected function bootstrap() { $request = $this->getRequest(); Yii::setAlias('@webroot', dirname($request->getScriptFile())); Yii::setAlias('@web', $request->getBaseUrl()); parent::bootstrap(); } /** * Handles the specified request. * @param Request $request the request to be handled * @return Response the resulting response
/** * {@inheritdoc} */ public function init() { $this->state = self::STATE_INIT; $this->bootstrap(); } /** * Initializes extensions and executes bootstrap components. * This method is called by [[init()]] after the application has been fully configured. * If you override this method, make sure you also call the parent implementation.
*/ public function __construct($config = []) { if (!empty($config)) { Yii::configure($this, $config); } $this->init(); } /** * Initializes the object. * This method is invoked at the end of the constructor after the object is initialized with the * given configuration.
$this->state = self::STATE_BEGIN; $this->preInit($config); $this->registerErrorHandler($config); Component::__construct($config); } /** * Pre-initializes the application. * This method is called at the beginning of the application constructor. * It initializes several important application properties.
* 添加fecshop的服务 ,Yii::$service , 将services的配置添加到这个对象。 * 使用方法:Yii::$service->cms->article; * 上面的例子就是获取cms服务的子服务article。 */ new fecshop\services\Application($config); $application = new yii\web\Application($config); $application->run();
$_GET = [ 'price' => '100-150', ];