Home > Backend Development > PHP Problem > How to convert php file gbk to utf8

How to convert php file gbk to utf8

藏色散人
Release: 2023-03-08 10:38:01
Original
2686 people have browsed it

How to convert php files from gbk to utf8: first create a directory to store the converted files; then create the corresponding folder; finally pass "-exec iconv -f GBK -t UTF-8 {} -o utf8/ ..." method to convert php files.

How to convert php file gbk to utf8

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

Convert PHP file GBK to UTF- 8

Convert gbk to utf8

[root@web ~]# mkdir utf8    //建立存放 转换后文件的目录
[root@web ~]# find templets1 -type d -exec mkdir utf8/{} \;  //建立对应的文件架
[root@web ~]# find templets1 -type f -name '*.php' -exec iconv -f GBK -t UTF-8 {} -o utf8/{} \;  //转换php文件
[root@web ~]# find templets1 -type f -name '*.htm' -exec iconv -f GBK -t UTF-8 {} -o utf8/{} \;
[root@web ~]# find templets1 -type f -name '*.html' -exec iconv -f GBK -t UTF-8 {} -o utf8/{} \;
[root@web ~]# find templets1 -type f -name '*.css' -exec iconv -f GBK -t UTF-8 {} -o utf8/{} \;  //有其他文本文件只要对后缀名做相应的改变即可
[root@web ~]#
Copy after login

After the conversion is completed, just overwrite the converted text file with the original encoding folder.

[Recommended learning: "PHP Video Tutorial"]

The above is the detailed content of How to convert php file gbk to utf8. 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