<small id='HIhY0'></small><noframes id='HIhY0'>

    • <bdo id='HIhY0'></bdo><ul id='HIhY0'></ul>

    1. <legend id='HIhY0'><style id='HIhY0'><dir id='HIhY0'><q id='HIhY0'></q></dir></style></legend>
      <i id='HIhY0'><tr id='HIhY0'><dt id='HIhY0'><q id='HIhY0'><span id='HIhY0'><b id='HIhY0'><form id='HIhY0'><ins id='HIhY0'></ins><ul id='HIhY0'></ul><sub id='HIhY0'></sub></form><legend id='HIhY0'></legend><bdo id='HIhY0'><pre id='HIhY0'><center id='HIhY0'></center></pre></bdo></b><th id='HIhY0'></th></span></q></dt></tr></i><div id='HIhY0'><tfoot id='HIhY0'></tfoot><dl id='HIhY0'><fieldset id='HIhY0'></fieldset></dl></div>
        <tfoot id='HIhY0'></tfoot>
      1. 在php中使用fputcsv将utf-8字符写入文件

        时间:2023-10-05

          <small id='XKpjx'></small><noframes id='XKpjx'>

          • <i id='XKpjx'><tr id='XKpjx'><dt id='XKpjx'><q id='XKpjx'><span id='XKpjx'><b id='XKpjx'><form id='XKpjx'><ins id='XKpjx'></ins><ul id='XKpjx'></ul><sub id='XKpjx'></sub></form><legend id='XKpjx'></legend><bdo id='XKpjx'><pre id='XKpjx'><center id='XKpjx'></center></pre></bdo></b><th id='XKpjx'></th></span></q></dt></tr></i><div id='XKpjx'><tfoot id='XKpjx'></tfoot><dl id='XKpjx'><fieldset id='XKpjx'></fieldset></dl></div>
              <bdo id='XKpjx'></bdo><ul id='XKpjx'></ul>
                <tbody id='XKpjx'></tbody>
              <legend id='XKpjx'><style id='XKpjx'><dir id='XKpjx'><q id='XKpjx'></q></dir></style></legend>

                  <tfoot id='XKpjx'></tfoot>
                1. 本文介绍了在php中使用fputcsv将utf-8字符写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想尝试用 PHP 在 CSV 文件中写入波斯字符,我正在使用 fputcsv 函数,但是如何使用 fputcsv 将 UTF-8 字符写入 CSV 文件?

                  I want to try write Persian character in CSV file in PHP, I am using fputcsv function but how can write UTF-8 character to CSV file with fputcsv?

                  我的部分代码:

                  $df = fopen($filepath, 'w');
                  fputcsv($df, array($coupon->code, $discount->label));
                  

                  推荐答案

                  试试这个:

                  $df = fopen($filepath, 'w');
                  fprintf($df, chr(0xEF).chr(0xBB).chr(0xBF));
                  fputcsv($df, array($coupon->code, $discount->label));
                  

                  fprintf($df, chr(0xEF).chr(0xBB).chr(0xBF)); 写入文件头以进行正确编码.

                  the line fprintf($df, chr(0xEF).chr(0xBB).chr(0xBF)); writes file header for correct encoding.

                  这篇关于在php中使用fputcsv将utf-8字符写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:使用 php 修复 html 文档上显示不正确的编码 下一篇:如何检测是否必须对字符串应用 UTF-8 解码或编码

                  相关文章

                  最新文章

                    <tfoot id='93ppy'></tfoot>

                    1. <legend id='93ppy'><style id='93ppy'><dir id='93ppy'><q id='93ppy'></q></dir></style></legend>
                        <bdo id='93ppy'></bdo><ul id='93ppy'></ul>
                      <i id='93ppy'><tr id='93ppy'><dt id='93ppy'><q id='93ppy'><span id='93ppy'><b id='93ppy'><form id='93ppy'><ins id='93ppy'></ins><ul id='93ppy'></ul><sub id='93ppy'></sub></form><legend id='93ppy'></legend><bdo id='93ppy'><pre id='93ppy'><center id='93ppy'></center></pre></bdo></b><th id='93ppy'></th></span></q></dt></tr></i><div id='93ppy'><tfoot id='93ppy'></tfoot><dl id='93ppy'><fieldset id='93ppy'></fieldset></dl></div>

                      <small id='93ppy'></small><noframes id='93ppy'>