Home >Backend Development >PHP Problem >How to solve the problem of php glob garbled characters

How to solve the problem of php glob garbled characters

藏色散人
藏色散人Original
2021-10-28 11:01:532222browse

Solution to php glob garbled characters: 1. Check and modify the web server character set and page character set; 2. Modify the configuration file content to "AddDefaultCharset UTF-8".

How to solve the problem of php glob garbled characters

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

php glob How about Chinese garbled characters deal with?

<?php
print_r(glob("*.txt"));
?>

But when the file name in the root directory is in Chinese, the output will appear. How to deal with garbled characters?

For example, create a new folder .txt

Solution:

Check the character set settings of your web server and the character set settings of the page .

If it is apache, the configuration file includes:

AddDefaultCharset UTF-8

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to solve the problem of php glob garbled characters. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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