#1 kao10324
function __construct(){ // 公用parent::__construct(); // 这是必须的
$this->connect();
}
function connect(){
header('Content-type: text/html;charset=utf-8');
require(APP_PATH."/config.php");
$host=$spConfig["db"]['host'];
$log=$spConfig["db"]['login'];
$pass=$spConfig["db"]['password'];
$db=$spConfig["db"]['database'];
$con=mysql_connect($host,$log,$pass)or die(mysql_error());
mysql_query("set names utf8");
mysql_select_db($db)or die(mysql_error());
}
为什么我写备份/还原函数.一定要进行上面这个数据库连接..写其它的操作.也进行了数据库的读写..而不需要上面这个连接就可以
2012-08-16 11:12:25