[請益] 一段CODE

看板PHP作者 (Hsu)時間19年前 (2006/12/02 22:52), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
麻煩看的懂的人 解釋一下 我看不懂 謝謝 <?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

12/02 23:01, , 1F
就是連結資料庫的class呀
12/02 23:01, 1F

12/02 23:04, , 2F
我看懂了Variable functions...謝謝
12/02 23:04, 2F
文章代碼(AID): #15SPCO_S (PHP)
文章代碼(AID): #15SPCO_S (PHP)