Home > Backend Development > PHP Problem > How to set character set in php

How to set character set in php

王林
Release: 2023-03-07 08:02:01
Original
3185 people have browsed it

How to set the character set in php: directly add the code [header('Content-type:text/html;charset=utf-8');] to the header of the php file.

How to set character set in php

If there is a problem with the character encoding displayed in our php file in the browser, such as garbled characters, then you can add the following code to the php file to solve this problem question.

(Learning video recommendation: java video tutorial)

The code is as follows:

<?php
    // 服务器读取的  编码设置
    header(&#39;Content-type:text/html;charset=utf-8&#39;);
?>
Copy after login

Related recommendations: php training

The above is the detailed content of How to set character set in php. For more information, please follow other related articles on the PHP Chinese website!

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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template