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

  • <legend id='TLWlb'><style id='TLWlb'><dir id='TLWlb'><q id='TLWlb'></q></dir></style></legend>

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

      1. PHP Excel 标头

        时间:2023-11-30
      2. <tfoot id='mfGXs'></tfoot>
        • <bdo id='mfGXs'></bdo><ul id='mfGXs'></ul>
              <tbody id='mfGXs'></tbody>

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

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

                <legend id='mfGXs'><style id='mfGXs'><dir id='mfGXs'><q id='mfGXs'></q></dir></style></legend>

                  本文介绍了PHP Excel 标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
                  header("Content-type:   application/x-msexcel; charset=utf-8");
                  header("Content-Disposition: attachment; filename=abc.xsl"); 
                  header("Expires: 0");
                  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                  header("Cache-Control: private",false);
                  echo "Some Text"
                  

                  这是使用 php 编写和下载 xsl 文件的代码,
                  我的问题是当我打开 excel 文件时 MS-Excel 在打开文件之前显示警告说

                  Here is code to write and download xsl file using php,
                  my problem is when i open excel file MS-Excel show warning before opening file says

                  您尝试打开的文件的格式与文件扩展名指定的格式不同...废话

                  The file you are trying to open is in different format than specified by the file extension...Blah blah

                  如何处理 PHP 代码来消除此警告?内容书写正确.

                  What's to do with PHP code to remove this warning? Contents are written correctly.

                  我知道这是因为文件中写入的内容是txt文件内容,文件扩展名不正确,即xls.解决方案?

                  I know this is because content written in file are txt file content and file extension is incorrect, that is, xls. Solution?

                  请不要建议使用任何库.

                  Please don't suggest to use any library.

                  推荐答案

                  您提供了多个 Content-Type 标头.application/vnd.ms-excel 就够了.

                  You are giving multiple Content-Type headers. application/vnd.ms-excel is enough.

                  还有一些语法错误.在 echo 语句和错误的文件扩展名上使用 ; 终止语句.

                  And there are couple of syntax error too. To statement termination with ; on the echo statement and wrong filename extension.

                  header("Content-Type:   application/vnd.ms-excel; charset=utf-8");
                  header("Content-Disposition: attachment; filename=abc.xls");  //File name extension was wrong
                  header("Expires: 0");
                  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
                  header("Cache-Control: private",false);
                  echo "Some Text"; //no ending ; here
                  

                  这篇关于PHP Excel 标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:php标头已发送错误 下一篇:面试问题:我们可以在标题之前有一个回声吗?

                  相关文章

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

                1. <tfoot id='oKqxo'></tfoot>
                2. <legend id='oKqxo'><style id='oKqxo'><dir id='oKqxo'><q id='oKqxo'></q></dir></style></legend>

                3. <small id='oKqxo'></small><noframes id='oKqxo'>

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