php 屏蔽deprecated,新人求教PHP高手,Deprecated?
這個是我寫的
include("db.php");
$db=new db("localhost","root","","數據庫名");
$db->dbConn();
mysql_query("set names utf8");
?>
class db
{
private $host;
private $user;
private $pwd;
private $db;
private $addtime;
function db($host,$user,$pwd,$db)
{
$this->host=$host;
$this->user=$user;
$this->pwd=$pwd;
$this->db=$db;
}
function dbConn()
{
@mysql_connect($this->host,$this->user,$this->pwd) or die("連接數據庫出錯!");
@mysql_select_db($this->db) or die("所用數據庫不存在!");
}
function dbQuery($sql)
{
$result=@mysql_query($sql) or die(mysql_error());
return $result;
}
function intoArray($result)
{
$row=@mysql_fetch_array($result);
return $row;
}
function totalRows($result)
{
$tRows=@mysql_num_rows($result);
return $tRows;
}
}
?>
總結
以上是生活随笔為你收集整理的php 屏蔽deprecated,新人求教PHP高手,Deprecated?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 如何用HTB进行Worker渗透测试
- 下一篇: Quintus是什么