/**
 * $a=new MysqliXyz;
 * $stmt=$a->sql($sql,"类型",?对应值);
 * $stmt->bind_result(...$list); //接收返回变量
 * $stmt->execute();
 * $stmt->fetch();  //单条数据查询
 * //多条数据
 $result=array();
 $temp=array();
 while($stmt->fetch()){
		$temp["passwd"]= $passwd;
		$result[]=$temp;
 }
 */
class MysqliXyz
{
	private $host="192.168.100.254";
	//private $sqlUser="root";
	private $sqlUser="root";
	private $sqlPasswd="qq282246101";
	private $sqlDb="xyz";
	public $stmt="";
	private $db=null;
	function __construct(){

		$this->db=new \mysqli($this->host,$this->sqlUser,$this->sqlPasswd,$this->sqlDb,3306);
		if ($this->db->connect_error) {
			die("连接 Mysaql 失败 ".$this->db->connect_error);
		}
		$this->db->set_charset("utf8");
	}
	//参数1 sql语句  参数2 ?对应类型  参数3 ?对应值 
	public function GetStmt($sql,$types,...$list){
		$this->stmt=$this->db->prepare($sql);
		$this->stmt->bind_param($types,...$list);
		return $this->stmt;
	}
	public function __destruct(){
		$this->stmt->close();
		$this->db->close();
	}
}
