代码之家  ›  专栏  ›  技术社区  ›  Wolfzmus

PHP到Excel的问题

  •  1
  • Wolfzmus  · 技术社区  · 7 年前

    在我先问我的编码之前,

    <?php
    header("Content-type: application/octet-stream");
    header("Content-Disposition: attachment; filename=T1/T2.xls");
    header("Pragma: no-cache");
    header("Expires: 0");
    ?>
    
    <table width="100%"" cellpadding="5" cellspacing="0">
    <tr>
      <td>+62-21-5900755</td>
      <td>2017-11-01</td>
    </tr>
    </table>
    

    当我开始运行这段代码时,一切正常,但我的问题是php上的输出不一样。喜欢 +62-21-5900755 换成 -5900714 和日期 2017-11-01 换成 01/11/2017 . 如何使我的输出与php上的输入值相同???

    找到了解决方案(其实不太可能) ' 在第一个字符串上,你们会得到如下格式 '+62-21-5900755 '2017-11-01 . 谢谢Vityata。

    1 回复  |  直到 7 年前
        1
  •  1
  •   Vityata    7 年前

    试着这样做:

    <table width="100%"" cellpadding="5" cellspacing="0">
    <tr>
      <td>'+62-21-5900755</td>
      <td>'2017-11-01</td>
    </tr>
    

    这个 ' 零件将保留其转换为文本。