<?phpnamespace apijson;use PDO;class Db{//连接PDO实例public static $con = null;//数据库所有表public static $tables;//当前操作的表public $table;public $field = "*";public $key = [];public $logic = [];public $val = [];private $PDOStatement;public function __construct(){}/*** connect*/public static function connect($server, $database, $name, $pwd, $port = 3306){if (!self::$con) {try {self::$con = new PDO("mysql:host={$server};dbname={$database}", $name, $pwd);self::$tables = self::$con->query("show tables")->fetchAll(PDO::FETCH_COLUMN);} catch (PDOException $e) {die($e->getMessage());}}}/*** exe main*/public function exe($request){var_dump($request);}/*** table*/public function table($table){$this->table = $table;return $this;}/*** field*/public function field($field){$this->field = $field;return $this;}/*** where*/public function where($where = []){$count = func_num_args();if ($count == 1) {if (is_array($where)) {foreach ($where as $k => $v) {$this->key[] = $k;if (is_array($v)) {} else {$this->logic[] = '=';$this->val[] = $v;}}}}}/*** query*/public function query($sql){$this->PDOStatement = self::$con->prepare($sql);$this->PDOStatement->execute();return $this->PDOStatement->fetchAll(PDO::FETCH_ASSOC);}/*** get*/public function get(){}}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。