PDO连接mysql数据库
<?php
$dsn="mysql:host=localhsot;dbname=lamp87";
$user="root";
$passwd="123";
$m = new PDO($dsn,$user,$passwd);
$stmt = $m->query("select * from stu");
$rows = $stmt->fetchAll();
var_dump($rows);
?>
PDO连接pgsql数据库
<?php
$dsn="pgsql:host=localhost;port=5432;dbname=lamp87;user=postgres;password=123456";
$m = new PDO($dsn);
$stmt = $m->query("select * from stu");
$rows = $stmt->fetchAll();
var_dump($rows);
?>