Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of php opendir garbled code

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to solve the php opendir garbled problem related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this article on how to solve the php opendir garbled problem will have a harvest, let's take a look at it.

Php opendir garbled solution: 1, open the corresponding PHP code file; 2, execute "$value=iconv (" UTF-8 "," gb2312 ", $value) before output;" statement; 3, unify all file coding into UTF-8 or gb2312.

This article operating environment: windows7 system, PHP7.1 version, DELL G3 computer

How to solve the php opendir garbled problem?

The solution of reading garbled codes in Chinese catalogue by php

Not long ago, there was a project that involved reading file directories using php. There was no problem in reading file directories, but there was garbled code in Chinese directories when reading. I didn't know what to do for a while. I haven't encountered this problem for a long time. I have studied it and come up with several solutions (the method of reading file directories using php is also attached):

(1) make a conversion before the output, plus the following code:

$value = iconv ("UTF-8", "gb2312", $value); / / or iconv ("gb2312", "UTF-8", $value)

(2) all file codes are unified as UTF-8 or gb2312

This is the end of the article on "how to solve the php opendir garbled problem". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "how to solve the problem of php opendir garbled". If you want to learn more knowledge, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report