pdp 的连接方法

<?php

$dsn = "mysql:host=127.0.0.1;dbname=blog_edu";
try{
$pdo = new PDO($dsn,'root','');
$pdo->query("SET NAMES UTF8");
$result = $pdo->query("SELECT * FROM tag");
$data = $result->fetchAll(PDO::FETCH_ASSOC);
echo "<pre>";
print_r($data);

}catch (PDOException $e){
echo $e->getMessage();
}

你可能感兴趣的:(pdp 的连接方法)