//造对象
$dsn = "mysql:dbname=mydb;host=localhost";
$pdo = new PDO($dsn,"root","123");
//写SQL语句,预处理语句
$sql = "select * from nation";
//准备执行
$st = $pdo->prepare($sql);
//执行
$st->execute();
//读数据
var_dump($st->fetchAll(PDO::FETCH_ASSOC));
//造对象
$dsn = "mysql:dbname=mydb;host=localhost";
$pdo = new PDO($dsn,"root","123");
//写SQL语句,预处理语句
$sql = "select * from nation";
//准备执行
$st = $pdo->prepare($sql);
//执行
$st->execute();
//读数据
var_dump($st->fetchAll(PDO::FETCH_ASSOC));