Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Connection
- {
- protected $link;
- private $dsn, $username, $password;
- public function __construct($dsn, $username, $password)
- {
- $this->dsn = $dsn;
- $this->username = $username;
- $this->password = $password;
- $this->connect();
- }
- private function connect()
- {
- $this->link = new PDO($this->dsn, $this->username, $this->password);
- }
- public function __sleep()
- {
- return array('dsn', 'username', 'password');
- }
- public function __wakeup()
- {
- $this->connect();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement