Can't php write Chinese characters?

藏色散人
Release: 2023-03-13 19:10:02
Original
1701 people have browsed it

php can write Chinese characters, but the encoding needs to be set. The setting method is to add the "header("Content-type:text/html; charset=utf-8");" code to the PHP page.

Can't php write Chinese characters?

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

php Can’t I write Chinese characters?

php can write Chinese characters, but the encoding needs to be set.

Chinese garbled characters

Just this sentence is enough

header("Content-type:text/html; charset=utf-8");
Copy after login

$_GET variable

contains Chinese characters The GET variable, if used in PHP, must be converted into GBK format, otherwise it cannot be displayed using the

';
//必须要转换成GBK
$dirname = iconv('utf-8', 'GBK', $dirname);
echo $dirname.'
'; ?>
Copy after login

browser

Cant php write Chinese characters?

complete Example

Take directory traversal as an example

';
                }
            }
        }
    }
}
read_all($dirname);
?>
Copy after login

Experimental effect

Cant php write Chinese characters?

Recommended study: "PHP Video Tutorial

The above is the detailed content of Can't php write Chinese characters?. 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!