<?php
header("Content-type:text/html;charset=utf-8");
try{
//用 pdo 连接数据库
$pdo = new PDO("mysql:host=localhost;dbname=project","root","");
//设置错误处理模式 异常处理错误处理模式
$pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){
echo "数据库连接失败,原因是".$e->getMessage();
}
//查询数据
$result=$pdo->query("select * from user limit 5");
查询到的中文显示问号 求解