PHP saves the txt file with the BOM header added and removes the BOM header from the txt file when reading
$str='Here are some Chinese'; //String $str = chr(0xEF).chr(0xBB).chr(0xBF).$ str; //Plus bom head $txt_path = '1.txt'; //File Save Path $fp = fopen($txt_path, "w"); fwrite($fp,$str); fclose($fp);
//This function comes from: https://www.feiniaomy.com/post/582.html function del_bom($contents){ $charset[1] = substr($contents, 0, 1); $charset[2] = substr($contents, 1, 1); $charset[3] = substr($contents, 2, 1); if (ord($charset[1]) == 239 && ord($charset[2]) == 187 && ord($charset[3]) == 191) { $rest = substr($contents, 3); return $rest; }else{ return $contents; } }
$txt_path = '1.txt'; //Txt file path $upload_txt = file_get_contents($txt_path); $upload_txt = del_bom($upload_txt); echo $upload_txt;
Can't find a tutorial that can solve your problem?
-
Charging zblogphp template The 9th zblog enterprise theme of Tianxing Studio has its own form to submit email reminders, etc zero 2019-12-11 eleven thousand two hundred and seven Price: four hundred and sixty-eight Online purchase -
Charging zblogphp template Tianxing Studio ppt download template is suitable for sites with resources to sell vips one 2019-10-03 nine thousand eight hundred and twenty-one Price: one hundred and ninety-nine Online purchase -
Wordpress template Tianxing Studio wordpress download station theme is applicable to software/app/game and other download stations zero 2022-05-06 five thousand four hundred and thirty-six Price: three hundred and fifty-five Online purchase -
Charging zblogphp template Tianxing Studio zblogphp enterprise theme 6 Self configurable atmosphere zblog enterprise theme two 2018-06-26 forty-four thousand eight hundred and eighty-four Price: two hundred and fifty-eight Online purchase
Related recommendations
-
Error causes and solutions of introducing vant into vue3 project 03-12 -
How does zblog intercept a summary with a specified number of words? Introduction to the custom interception method of zblog summary 02-29 -
51. If the js file counted by la is hijacked, it will jump to the illegal website 09-27 -
The solution of "This order has expired, please re order" will be prompted after the payment is started by the WeChat payment JSP AI 06-11 -
The reason and solution of "failure to connect to the server" prompted by pagoda one click migration 05-16 -
WeChat applet error: operateWXDataForAd: fail reason and solution 05-14 -
PHP saves the txt file with the BOM header added and removes the BOM header from the txt file when reading 05-02 -
The reason and solution of blank output of applet after using mp html component 04-08 -
Introduction to the parameters and usage of the function GetCategoryList for zblog to obtain all categories 03-30 -
EMlog obtains the title link and other data of the specified classification through the classification ID 03-20 -
The reason and solution for the prompt No input file specified on the phpstudy 03-07 -
Zblog gets the title/link/ID and other attributes of the current page 02-02 -
Windows+php studio+Apache set the method to allow cross domain requests 01-09 -
Troubleshooting method and solution for website using pagoda panel server CPU occupying 100% 01-04 -
How does the zblog application center issue invoices? Invoicing process after purchasing an application in the zblog application center 11-29 -
Detailed description of zblog template article publishing time format 11-23
welcome you Comment: Cancel Reply
-
Zblog enterprise theme -
Zblog image theme -
Zblog resource topic -
Zblog CMS topic -
Wordpress template -
Zblog video theme -
Zblog Taobao guest theme -
Zblog navigation topic
Select a theme?
-
Latest articles -
Hot article ranking -
Most Comments
-
one Shopping activity on the official website of Tianxing Studio: unlimited number of times and amount of 20% discount coupons 04-17 -
two Tianxing Studio zblog pure blog theme vue3+applet dual version 03-19 -
three Error causes and solutions of introducing vant into vue3 project 03-12 -
four Tianxing Studio zblog encyclopedia theme can be matched with member plug-ins to realize knowledge payment profitability 03-06 -
five How does zblog intercept a summary with a specified number of words? Introduction to the custom interception method of zblog summary 02-29 -
six Tianxing Studio 2023 Double 11 Event: 50% discount coupons 11-05 -
seven Tencent Cloud 2023 Double 11 Activity: 2H2G3M lightweight server 88 new users for one year 11-05 -
eight AliCloud 2023 Double 11 Activity: 2-core 2G3M bandwidth ECS 99 yuan/year! 10-31 -
nine Tianxing Studio zblog free login paid reading plug-in supports Alipay WeChat payment Hupi Pepper payment 10-09
-
Label aggregation -
×1 Wordpress Top ×1 Blog ×1 SuperSlide ×1 Wuhan etc ×1 Zblog file ×1 Current classification ×1 Kubi Rubik's Cube ×1 Specify classification ×1 diary ×1 Zblogphp Enterprise Theme ×1 Wordpress Download ×1 Install Theme ×1 be devoid of any sense of shame ×1 templates installing ×1 Zblog version ×1 Wordpress classification alias ×1 celebrate the Spring Festival ×1 Ie browser test tool ×1 Crude oil transaction template ×1 Adaptive background
Latest comments
-
Tianxing Studio 03-21 Yes, it will be repaired in the next version Commented on: Tianxing Studio zblog pure blog theme vue3+applet dual version -
visitor 03-20 This template has multiple side-by-side pictures. No matter which picture you click, the first picture will be displayed. There is no carousel button, and you can only manually close it. System: win7+Firefox Commented on: Tianxing Studio zblog pure blog theme vue3+applet dual version -
Tianxing Studio 01-19 I don't understand. Do you want to create categories in batches? This is not considered by the theme of plug-ins Commented on: Tianxing Studio zblog cms theme charging version supports extreme personalized configuration -
visitor 01-18 It is too troublesome to classify and set one by one. Can you add classification settings in the theme settings. Commented on: Tianxing Studio zblog cms theme charging version supports extreme personalized configuration -
Tianxing Studio 01-16 I don't quite understand your requirements. Please contact our online qq2076496616 to provide the order number to specify your requirements Commented on: Tianxing Studio zblog cms theme charging version supports extreme personalized configuration