Mysql::__construct PHP Method

__construct() private method

构造函数为private,防止创建对象
private __construct ( )
    private function __construct()
    {
        $this->conn = mysql_connect('localhost', 'root', '');
    }

Usage Example

Exemplo n.º 1
0
	public function __construct($port){   //重写了继承过父类的参数

		//有了保险,选继承父类的构造函数
		parent::__construct();
		$this->prot = $port;
		$this->conn = mysql_connect("localhost:$prot", 'root', '123456');
		echo $this->port,'----<br/>';



	}
All Usage Examples Of Mysql::__construct