第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

這是什么錯誤?

這是什么錯誤?

錯過了年華 2017-06-21 19:20:00
class?MysqlConn { public?$dbtype; public?$host; public?$dbname; public?$user; ????public?$pwd; function?__construct($dbtype,$dbname,$host,$user,$pwd) { $this->dbtype=$dbtype; $this->host=$host; $this->dbname=$dbname; $this->user=$user; $this->pwd=$pwd; if($this->dbtype=="mysql"?||?$this->dbtype=="mssql") { ???? ????$dsn="$this->dbtype:host=$this->host;dbname=$this->dbname"; ????} else { ????$dsn="$this->dbtype:dbname=$this->dbname"; ????} try? { $conn?=?new?PDO($dsn,?$this->user,?$this->pwd);? //初始化一個PDO對象,就是創(chuàng)建了數(shù)據(jù)庫連接對象$pdo $conn->query("set?names?utf8"); return?$conn; ????}? catch(PDOException?$e) { ???? ????die("Error!:?"?.?$e->getMessage()?.?"<br/>"); ????}???? }? } $conn=new?MysqlConn("mysql","dzxx_db","localhost","admin","123");//數(shù)據(jù)庫連接類實(shí)例化,執(zhí)行連接操作,返回連接標(biāo)識
查看完整描述

3 回答

?
天使之翼死神之鐮

TA貢獻(xiàn)81條經(jīng)驗(yàn) 獲得超102個贊

$dsn的值有問題,正確的應(yīng)該分別是?$dsn=$this->dbtype.":host=".$this->host.";dbname=".$this->dbname;和$dsn=$this->dbtype.":dbname=".$this->dbname;

查看完整回答
1 反對 回復(fù) 2017-06-22
點(diǎn)擊展開后面1
?
錯過了年華

TA貢獻(xiàn)56條經(jīng)驗(yàn) 獲得超22個贊

class?ConnDB{
	
	var?$dbtype;
	var?$host;
????var?$user;
????var?$pwd;
????var?$dbname;
????
	//構(gòu)造方法
????function?ConnDB($dbtype,$host,$user,$pwd,$dbname){
		$this->dbtype=$dbtype;
?????????	$this->host=$host;
		$this->user=$user;
		$this->pwd=$pwd;
		$this->dbname=$dbname;
	}

????//實(shí)現(xiàn)數(shù)據(jù)庫的連接并返回連接對象
????function?GetConnId(){
?????	
????	if($this->dbtype=="mysql"?||?$this->dbtype=="mssql"){
????		$dsn="$this->dbtype:host=$this->host;dbname=$this->dbname";
		}else{
			$dsn="$this->dbtype:dbname=$this->dbname";
		}????
		try?{
????		$conn?=?new?PDO($dsn,?$this->user,?$this->pwd);?	//初始化一個PDO對象,就是創(chuàng)建了數(shù)據(jù)庫連接對象$pdo
			$conn->query("set?names?utf8");
????		return?$conn;
		}?catch?(PDOException?$e)?{
????		die?("Error!:?"?.?$e->getMessage()?.?"<br/>");
		}

?????	
????}	
}

上面這個是原本的類,可沒見需要像你那樣寫啊



查看完整回答
反對 回復(fù) 2017-06-23
  • 3 回答
  • 0 關(guān)注
  • 1650 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號