鍍金池/ 問(wèn)答/PHP  網(wǎng)絡(luò)安全/ thinkphp中where數(shù)組格式可以這樣寫(xiě)嗎?

thinkphp中where數(shù)組格式可以這樣寫(xiě)嗎?

$select = array("id" => 1,"first" => 0);
$data = $this -> Count($select);

方法是:
public function Count($where){

$count = $this -> where($where) -> count();

}
為什么查出來(lái)的是整個(gè)表?

回答
編輯回答
念初

var_dump(this->_sql());查看執(zhí)行的sql

2017年8月4日 00:09
編輯回答
笑忘初

你用fetchsql(true) 輸出一下,看看解析的原始SQL語(yǔ)句是什么,是不是你要的句子

2017年5月4日 20:50
編輯回答
巷尾

懷疑你查詢(xún)的時(shí)候$where是空

2017年6月26日 05:09
編輯回答
青瓷

方法名count建議可以換一下,避免關(guān)鍵字的沖突.

2018年9月10日 08:21