萬盛學電腦網

 萬盛學電腦網 >> 網絡編程 >> php編程 >> 入門級php 數據庫連接類

入門級php 數據庫連接類

 代碼如下 復制代碼

class mysql教程{
     private $host;
     private $name;
     private $pass;

    function __construct($host,$name,$pass){
        $this->host=$host;
        $this->name=$name;
        $this->pass=$pass;
        $this->connect();

    }

    function connect(){

        mysql教程_connect($this->host,$this->name,$this->pass)or die(
        mysql_error());

 

    }
 }


 $db=new mysql('localhost','root','dfd');
//這是一個超簡單的mysql+php教程數據庫教程連接類程序。

copyright © 萬盛學電腦網 all rights reserved