Login
网站首页 > 文章中心 > 其它

关于db.class.php的信息

作者:小编 更新时间:2023-10-08 19:51:56 浏览量:281人看过

错误位置: FILE:/www/shidu/ThinkPHP/Lib/Core/Db.class.php LINE:640 在线等 急啊.

这种的肯定不是这个db.class.php的错误

看看调试模式是否开启了,没有开启的建议开启就能看到详细的报错信息了

或者贴出你的代码

关于db.class.php的信息

php.Db.class.写法

php

class Db{

public $host;

public $username;

public $password;

public $database;

public $conn;

public $table;

public $sql;

public $field = '*';

function __construct($host,$username,$password,$database){

$this-host = $host;

$this-username = $username;

$this-password = $password;

$this-database = $database;

$this-connect();

}

function connect(){

$this-conn = new mysqli($this-host, $this-username, $this-password,$this-database);

if ($this-conn-connect_error) {

die("连接失败: " . $this-conn-connect_error);

function M($table){

$this-table = $table;

return $this;

function where($array){

$this-sql = '';

$sql = 'where ';

$one = '';

if($array){

if(is_array($array)){

foreach($array as $key=$vo){

$one .= '◆'.$key.'◆ = "'.$vo.'" and';

$one = trim($one,'and');

$sql .= $one;

$this-sql = $sql;

}else{

$sql .= $array;

function add($array){

$sql = 'insert into ◆'.$this-table.'◆ (';

$two = '';

$one .= '◆'.$key.'◆ ,';

$two .= '"'.$vo.'",';

$one = trim($one,',');

$two = trim($two,',');

if($one $two){

$sql .= $one.') values ('.$two.')';

$r = $this-conn-query($this-sql);

if($r){

return mysqli_insert_id($this-conn);

return false;

exit('非数组');

exit('数组为空');

function select(){

$array = '';

$sql = 'select '.$this-field.' from ◆'.$this-table.'◆'.$this-sql;

$result = $this-conn-query($sql);

if ($result-num_rows 0) {

while($row = $result-fetch_assoc()) {

$array[] = $row;

return $array;

function find(){

$row = '';

$sql = 'select '.$this-field.' from ◆'.$this-table.'◆'.$this-sql.'limit 1';

$row = $result-fetch_assoc();

return $row;

function edit($array){

$sql = 'update ◆'.$this-table.'◆ set ';

$one .= '◆'.$key.'◆ = "'.$vo.'",';

$sql .= $one.' '.$this-sql;

$sql .= $array.' '.$this-sql;

$r = $this-conn-query($sql);

return true;

exit('未接收到参数');

function delete(){

$sql = 'delete from ◆'.$this-table.'◆ ';

$sql .= $this-sql;

function order($data){

$this-sql = $this-sql.' order by '.$data;

function limit($data){

$this-sql = $this-sql.' limit '.$data;

function field($data){

$this-field = $data;

$db = new Db('localhost','root','root','database');

错误位置: FILE: D:\wwwroot\navicle\t\Lib\Core\Db.class.php LINE: 214如何解决的

①.:用户名密码不对

②.:权限设置的有问题,你可以在 phpmyadmin里,找到用户列表,然后设置权限.

新手求助,有Db.class.php,Class Db'not found

有 Db.class.php ,在实际使用时,还需要 include 文件,而且源代码中要确实定义了 class db.

以上就是土嘎嘎小编为大家整理的关于db.class.php的信息相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!

版权声明:倡导尊重与保护知识产权。未经许可,任何人不得复制、转载、或以其他方式使用本站《原创》内容,违者将追究其法律责任。本站文章内容,部分图片来源于网络,如有侵权,请联系我们修改或者删除处理。

编辑推荐

热门文章