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 garbled code of fread function in php

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to solve the problem of garbled code of fread function in php. It is very detailed and has certain reference value. Interested friends must finish reading it.

Php fread function garbled solutions: 1, read the file directly through the fread function; 2, read the content through the "iconv ('gbk',' utf-8', $data)" method to transcode.

This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer

Problem description:

Php, through the fread function to read the file directly, the file content if encountered in Chinese, there will be garbled problem, how to solve this?

Solution:

Try to transcode the content after reading it.

Iconv ('gbk',' utf-8', $data)

Related introduction:

Iconv_get_encoding-gets the internal configuration variables of the iconv extension

Iconv_mime_decode_headers-decode multiple MIME header fields at once

Iconv_mime_decode-Decoding a MIME header field

Iconv_mime_encode-Composes a MIME header field

Iconv_set_encoding-sets the current setting for character encoding conversion

Iconv_strlen-returns the character count of a string

Iconv_strpos-Finds position of first occurrence of a needle within a haystack

Iconv_strrpos-Finds the last occurrence of a needle within a haystack

Iconv_substr-intercepts the portion of a string

Iconv-the string is converted according to the required character encoding

Ob_iconv_handler-converts character encodings with an output buffer handler

These are all the contents of this article entitled "how to solve the problem of garbled codes of fread functions in php". Thank you for reading! Hope to share the content to help you, more related knowledge, 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