Home > php教程 > php手册 > body text

php5 pdo新改动加载注意事项

WBOY
Release: 2016-06-13 12:27:13
Original
806 people have browsed it

前面的#号去了,但是加载不了,仔细一看,哦,原来还有个
extension=php_pdo.dll
于是,就OK了

顺便说下,不要再把ext下的dll文件拷到windows目录下了,在环境变量里把php的路径加进去就行了,这样好点。是吧?

原来的中文问题是这样解决
在查询之前
mysql_query("set names 'utf8'");
而用了pdo后 

复制代码 代码如下:


$dbh = new PDO($dsn, $user, $pass); //初始化一个PDO对象,就是创建了数据库连接对象$dbh
echo "连接成功
";
//你还可以进行一次搜索操作
$dbh->query("set names utf8");//就这样。。。


5 记住:字符集一定要统一,数据库的,网站的。页面的
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template