public __construct ( array $config ) | ||
$config | array |
public function __construct($config)
{
parent::__construct();
$this['config'] = function () use($config) {
return new Config($config);
};
if ($this['config']['debug']) {
error_reporting(E_ALL);
}
$this->registerProviders();
$this->registerBase();
$this->initializeLogger();
Http::setDefaultOptions($this['config']->get('guzzle', ['timeout' => 5.0]));
foreach (['app_id', 'secret'] as $key) {
!isset($config[$key]) || ($config[$key] = '***' . substr($config[$key], -5));
}
Log::debug('Current config:', $config);
}
public function __construct(array $config) { parent::__construct($config); /** * if set component init access_token from component */ if (isset($config['component_app_id']) && $config['component_app_secret'] && !empty($config['component_app_id']) && !empty($config['component_app_secret'])) { //注册auth_guard $this->register(new AuthGuardServiceProvider()); if (isset($config['app_id'])) { //如果是处理调用授权的逻辑,不能设置这个参数,只有代公众号使用相关功能才能传递这个参数 $this->setAuthorizerAppId($config['app_id']); } } }