public function __construct($database = '') { $this->servers = IS_PRODUCTION ? $this->serversProduction : $this->serversDevelop; //以下是特殊处理(因为多个站点用的同一个model),不正规 $isDevelop = IS_PRODUCTION ? '' : '-test'; if (defined('APP_BLOG_NAME') && APP_BLOG_NAME != 'www') { $this->servers['master']['database'] = 'blog_' . APP_BLOG_NAME . $isDevelop; $this->servers['slave']['database'] = 'blog_' . APP_BLOG_NAME . $isDevelop; } elseif ($database) { $this->servers['master']['database'] = $database . $isDevelop; $this->servers['slave']['database'] = $database . $isDevelop; } parent::__construct(); }
public function __construct() { $this->servers = IS_PRODUCTION ? $this->serversProduction : $this->serversDevelop; parent::__construct(); }