php教程

Yaf_Application::__sleep

(Yaf >=1.0.0)

Yaf_Application::__sleepYaf_Application 不能被序列化

说明

private Yaf_Application::__sleep ( void ) : void

参数

此函数没有参数。

返回值

User Contributed Notes

akbarishahin at gmail dot com 15-Jan-2019 07:11
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');
    }
   
   
}

CopyRight © 2008-2022 verySource.Com All Rights reserved. 京ICP备17048824号-1 京公网安备:11010502034788