Solution to garbled php page

藏色散人
Release: 2023-03-07 07:32:01
Original
3653 people have browsed it

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.

Solution to garbled php page

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(&#39;127.0.0.1&#39;, &#39;root&#39;, &#39;123456&#39;, &#39;test&#39;); 本地地址 数据库登录名  登录密码  数据库名
mysqli_set_charset($con,"utf8");//设置默认客户端字符集。 数据库链接好后紧接着就设置字符集
?>
Copy after login

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!

Related labels:
php
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!