各位新手注意了!!~关于类的一个错误
class DB
{
var $Server_url = "localhost";
var $Server_name = "root";
var $Server_pwd = "123456";
var $Server_db = "lihaoDB";
//数据库信息
function conn()//连接数据库------------------
{
$connect = mysql_connect($this -> Server_url,$this -> Server_name,$this -> Server_pwd) or die("数据库信息有误!错误信息:".mysql_error());
mysql_select_db ($this -> Server_db) or die ("数据库表连接错误!".mysql_error());
return $connok;
}
}
这是一个连接数据库的类,调用了半天,才发现
mysql_connect($this -> $Server_url,$this -> $Server_name,$this -> $Server_pwd)
这句里面变量不能有"$"符号..搞了半天.....
$this -> $Server_url
要改成:
$this -> Server_url
本来类写的没问题的....就搁在这里了,真是晕死啊!!!!