/** * 初始化信息 * @param array $data */ public function __construct(array $data = []) { parent::__construct($data); foreach (static::$config as $name => $realName) { $this->set($name, isset($_SERVER[$realName]) ? trim($_SERVER[$realName]) : null); } $this->init(); }
/** * __construct * @param mixed $data * @param string $format * @param string $name */ public function __construct($data = [], $format = 'php', $name = 'box1') { // Optionally load supplied data. if (is_array($data) || is_object($data)) { $this->bindData($this->data, $data); } elseif ($data && is_string($data)) { $this->load($data, $format); } parent::__construct(); $this->name = $name; }
/** * don't allow set attribute * @param array $options * @throws InvalidConfigException */ public function __construct($options = []) { parent::__construct(); ObjectHelper::loadAttrs($this, $options); if ($this->identityClass === null) { throw new InvalidConfigException('User::identityClass must be set.'); } // if have already login if (session(self::$saveKey)) { $this->refreshIdentity(); } }