Convert the encoding of all files in the PHP folder
The encoding of all files in the PHP conversion folder is suitable for other encoding versions released on the website. for example, if you have a GBK version, you want to have a UTF8 version or you only have the GBK source code. you want to develop it again, but you don't want to change it. you can use this program to convert the encoding method of IDE into UTF8 in batches:
The code is as follows:
-
- $ Input_encoding = 'gbk ',
- $ Output_encoding = 'utf-8') {if (file_exists ($ filename ))
- {If (is_dir ($ filename )){
- Foreach (glob ("$ filename
- $ Contents_after = iconv ($ input_encoding, $ output_encoding, $ contents_before );
- File_put_contents ($ filename, $ contents_after) ;}} else
- {Echo 'parameter error'; return false ;}} iconv_file ('./test');?>
I hope this article will be helpful to the majority of php developers. thank you for reading this article. MorePhp technical problemsWelcome to group discussion:256271784, Verification code:CxyIf you do not write the verification code, it will not pass yo ~
|