关于PHP 查询 mysql 乱码问题解决方式

PHP只认 utf8 而不是 utf-8

 $cfg = parse_ini_file("system.ini");
		echo $cfg['hostanme'];
		$db=new PDO('mysql:host='.$cfg['hostanme'].';dbname='.$cfg['dbname'], $cfg['username'],$cfg['password']);
		$db->exec("set character_set_client = utf8");
		$db->exec("SET character_set_results =utf8");
		$db->exec("SET character_set_connection = utf8");


发布了27 篇原创文章 · 获赞 53 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/auspi12341/article/details/16863669