Ejemplo n.º 1
0
 function __construct($DBname, $DBip, $DBuser, $DBpwd, $memSwitch = false, $memPort, $memName, $memPath)
 {
     $this->DBname = $DBname;
     $this->DBip = $DBip;
     $this->DBuser = $DBuser;
     $this->DBpwd = $DBpwd;
     $this->memcache_switch = $memSwitch;
     try {
         $this->PDO_LINK = new PDO("mysql:host={$this->DBip};dbname={$this->DBname};", $this->DBuser, $this->DBpwd);
         if ($memSwitch == true) {
             \RSystem\system::load_class($memName, $memPath, 0);
             memcacheClass::init($memPort);
         }
         $this->PDO_LINK->setAttribute(PDO::ATTR_AUTOCOMMIT, 1);
         $this->PDO_LINK->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         // $this->PDO_LINK->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
     } catch (PDOException $e) {
         die("connect fail!" . $e->getMessage());
     }
     $this->PDO_LINK->query('set names utf8');
 }