abstrakt:<?php class Curl { public $pdo = ''; public function __construct(){//try拋出異常處理 try{ $this->pdo = new PDO("mysql:host=127.0.0.1;dbname=1604a",'root
<?php
class Curl
{
public $pdo = '';
public function __construct(){
//try拋出異常處理
try{
$this->pdo = new PDO("mysql:host=127.0.0.1;dbname=1604a",'root','root');
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
$mysqli = new Curl();
?>
Korrigierender Lehrer:韋小寶Korrekturzeit:2019-03-14 16:58:10
Zusammenfassung des Lehrers:目前在PHP中使用最多連接數(shù)據(jù)庫的方式就是pdo 當(dāng)然也有使用mysqli的 pdo可以連接任何類型的數(shù)據(jù)庫 使用起來也很方便簡(jiǎn)單