<?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();
}
posted on 2016-02-01 13:19  阳光小白  阅读(438)  评论(0编辑  收藏  举报