第一,设置php文件的编码格式是Utf8
第二,MySQL数据库中字段用utf8,默认是lation1
第三,在php文件的顶部加上:header('Content-Type:text/html;charset=utf-8');
第四,在建立数据库链接的时候后加上红色字体部分:
$connection = mysqli_connect("localhost", "root", "","fb_tutorial_db");
mysqli_query($connection,"SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary, sql_mode='' ");
这样基本上就能搞定php链接Mysql数据库出现中文乱码问题