Exemple #1
0
 public function __construct($obj = null)
 {
     if (isset($obj)) {
         if (is_object($obj)) {
             $this->_obj = $obj;
         } else {
             if (is_string($obj)) {
                 try {
                     if (func_num_args()) {
                         $p = func_get_args();
                         unset($p[0]);
                         $ref = new ReflectionClass($obj);
                         $this->_obj = $ref->newInstanceArgs($p);
                         unset($ref);
                     } else {
                         $this->_obj = new $obj();
                     }
                 } catch (Exception $e) {
                     throw new Exception('Class "' . $obj . '" does not exists.');
                 }
             }
         }
     }
     parent::__construct();
 }
Exemple #2
0
 public function __construct($para = array())
 {
     if (!empty($para)) {
         $this->_table = $para['table'];
         $this->_pk = $para['pk'];
     }
     if (isset($this->_pre_cache_key) && (($ttl = getglobal('setting/memory/' . $this->_table)) !== null || ($ttl = $this->_cache_ttl) !== null) && memory('check')) {
         $this->_cache_ttl = $ttl;
         $this->_allowmem = true;
     }
     if (getglobal('setting/CorpID') && getglobal('setting/CorpSecret')) {
         $this->_wxbind = true;
     }
     $this->_init_extend();
     parent::__construct();
 }