封装

<?php

class Dadb

{

  public $host = "localhost";

  public $uid = "uid";

  public $pwd = "pwd";

  public $dbname = "test";

  function query($sql,$type=1)

  {

    $db = new MySQLi($this->host,$this->uid,$this->pwd,$this->dbname);

    $result = $db->query($sql);

    if($type)

    {

      return $result->fetch_all();

    }

    else

    {

      return $result;

    }

  }

}

posted @ 2017-05-23 15:18  繁华似水  阅读(74)  评论(0编辑  收藏  举报