include/class/pdoClass.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php
include_once('mysql.php');
class pdoClass extends mysql{
	
	
	protected function connect()
	{
		$this->errormsg	= '';
		if(!class_exists('PDO'))exit('操作数据库的php的扩展PDO不存在');
		try {
			$this->conn = @new PDO('mysql:host='.$this->db_host.';dbname='.$this->db_base.'', $this->db_user, $this->db_pass);
			$this->conn->query("SET NAMES 'utf8'");
			$this->selectdb($this->db_base);
			$this->conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
		} catch (PDOException $e) {
			$this->conn 	= null;
			$this->errormsg = $e->getMessage();
		}
	}
	
	protected function querysql($sql)
	{
		try {
			$bo = $this->conn->query($sql);
		} catch (PDOException $e) {
			$bo = false;
			$this->setError($e->getMessage(), $sql);
		}
		return $bo;
	}
	
	public function fetch_array($result, $type = 0)
	{
		$result_type = ($type==0)? PDO::FETCH_ASSOC : PDO::FETCH_NUM;
		return $result->fetch($result_type);
	}
	
	public function insert_id()
	{
		return $this->conn->lastInsertId();
	}
	
	protected function starttran()
	{
		$this->conn->beginTransaction();
	}
	
	protected function endtran($bo)
	{
		if(!$bo){
			$this->conn->rollBack();
		}else{
			$this->conn->commit();
		}
	}
		
	
	
	public function close()
	{
后面还有 4 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。