作者Hsu0301 (Hsu)
看板PHP
标题[请益] 一段CODE
时间Sat Dec 2 22:53:04 2006
麻烦看的懂的人 解释一下
我看不懂 谢谢
<?php
class db {
private $host = 'localhost';
private $user = 'username';
private $pass = 'password';
private $type = 'mysqli';
public $lid = 0;
// Connection function
function connect() {
$connect = $this->type.'_connect';
if (!$this->lid = $connect($this->host, $this->user, $this->pass)) {
die('Unable to connect.');
}
}
}
$db = new db;
$db->connect();
?>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.171.150.27
1F:推 suckerlove:就是连结资料库的class呀 12/02 23:01
2F:→ Hsu0301:我看懂了Variable functions...谢谢 12/02 23:04