首页上一页 1  下一页尾页 3 条记录 1/1页
        php数据库链接类中 数据库关闭方法看不懂!
                 	
                        发表在PHP图书答疑
                        2014-09-22                                                
                    		
                                                                            	
                        
                        
                    
                    
                    	是否精华
                    	是
                    	否
                    
                    
                    
                            版块置顶:
                            是
                            否
                        
                    
                                           class ConnDB{
var $dbtype;
var $host;
var $user;
var $pwd;
var $dbname;
var $conn;
function ConnDB($dbtype,$host,$user,$pwd,$dbname){ //构造方法,为成员变量赋值
$this->dbtype=$dbtype;
$this->host=$host;
$this->user=$user;
$this->pwd=$pwd;
$this->dbname=$dbname;
}
function GetConnId(){ //实现与数据库的连接并返回连接对象
$this->conn=mysql_connect($this->host,$this->user,$this->pwd) or die("数据库服务器连接错误".mysql_error());
mysql_select_db($this->dbname,$this->conn) or die("数据库访问错误".mysql_error());
mysql_query("set names gb2312"); //设置数据库的编码格式
return $this->conn; //返回连接对象
}
function CloseConnId(){ //定义关闭数据库的方法
$this->conn->Disconnect(); //执行关闭的操作
}
}
=========================================================================
$this->conn->Disconnect(); 管理员解释下这句怎么工作的 ,真心看不懂!!
==========================================================================
        
                
        	
        
        
    var $dbtype;
var $host;
var $user;
var $pwd;
var $dbname;
var $conn;
function ConnDB($dbtype,$host,$user,$pwd,$dbname){ //构造方法,为成员变量赋值
$this->dbtype=$dbtype;
$this->host=$host;
$this->user=$user;
$this->pwd=$pwd;
$this->dbname=$dbname;
}
function GetConnId(){ //实现与数据库的连接并返回连接对象
$this->conn=mysql_connect($this->host,$this->user,$this->pwd) or die("数据库服务器连接错误".mysql_error());
mysql_select_db($this->dbname,$this->conn) or die("数据库访问错误".mysql_error());
mysql_query("set names gb2312"); //设置数据库的编码格式
return $this->conn; //返回连接对象
}
function CloseConnId(){ //定义关闭数据库的方法
$this->conn->Disconnect(); //执行关闭的操作
}
}
=========================================================================
$this->conn->Disconnect(); 管理员解释下这句怎么工作的 ,真心看不懂!!
==========================================================================

	
                                                
购物车
发表新帖
立即签到
                






