In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to make the role of PHP transcoding in Excel reading. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
PHP transcoding is a relatively basic knowledge point, but for most beginners of the PHP language, its importance is often ignored. Today we will specifically explain the role of PHP transcoding in Excel reading.
PHP has developed a lot, now pear is very convenient to use, in which there are relevant class to read the contents of the Excel file, if you do not want to use pear, you can consider using excel_class.php,google, you can find the source code download of this class, you can also find the basic example code, it is very convenient to use.
It should be noted that what is read from Excel belongs to PHP coding. If you use excel_class in mobile applications, you need to pay attention to it, because usually mobile phones support UTF-8 coding, which involves code conversion.
For example, I use the
Echo $return [Sheet2] [0] [0]
To display the contents of row 1 and column 1, the original content is "start", and it is indeed "start" when it is displayed on web using PHP, but the source code of the web page is
& # 2432022987
The & # is for display on the web page, and the hexadecimal representations of 24320 and 22987 are UTF-16LE codes for "start".
Then all we need to do is convert this UTF-16LE code to UTF-8 code.
First of all, open excel_class.php, find the function uc2html, comment out the code in the function, and return the parameters directly, that is, change the function to do nothing.
Function uc2html ($str) {
Return $str
}
Next, use the function mb_convert_encoding provided in PHP to convert UTF-16LE to UTF-8.
Echo mb_convert_encoding ($UTF-8', [Sheet2] [0] [0], 'Sheet2' UTF-16LE')
At this point, the PHP transcoding from UTF-16LE to UTF-8 is completed.
The above content is how to make the role of PHP transcoding in Excel reading. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.