Solution to garbled php page: 1. Set the text encoding displayed on the page through "header("Content-Type:text/html;charset=utf-8");"; 2. Through "mysqli_set_charset" Set the default client character set.
Recommended: "PHP Video Tutorial"
php: Solution to garbled pages
in
<?php header("Content-Type:text/html;charset=utf-8"); ////设置页面显示的文字编码 头部就写header函数处理成utf-8 //链接数据库 $con = mysqli_connect('127.0.0.1', 'root', '123456', 'test'); 本地地址 数据库登录名 登录密码 数据库名 mysqli_set_charset($con,"utf8");//设置默认客户端字符集。 数据库链接好后紧接着就设置字符集 ?>
The above is the detailed content of Solution to garbled php page. For more information, please follow other related articles on the PHP Chinese website!