<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 标头

        PHP Excel Header(PHP Excel 标头)
      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 Upload File Validation(PHP 上传文件验证)
                  PHP Error - Uploading a file(PHP 错误 - 上传文件)
                  How can I write tests for file upload in PHP?(如何在 PHP 中编写文件上传测试?)
                  php resizing image on upload rotates the image when i don#39;t want it to(php在上传时调整图像大小会在我不想要它时旋转图像)
                  How to send additional data using PLupload?(如何使用 PLupload 发送附加数据?)
                  change button text in js/ajax after mp4 =gt;mp3 conversion in php(在 php 中的 mp4 =gt;mp3 转换后更改 js/ajax 中的按钮文本)
                  • <bdo id='oKqxo'></bdo><ul id='oKqxo'></ul>

                    <tfoot id='oKqxo'></tfoot>
                      <tbody id='oKqxo'></tbody>

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

                    • <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>