亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我在將 html 頁面導出到 word 時出現錯誤?

為什么我在將 html 頁面導出到 word 時出現錯誤?

PHP
嗶嗶one 2023-09-22 16:31:06
我在嘗試添加表格的新行時遇到錯誤,一切正常,我可以將我的 html 頁面導出到 MS Word。我收到這樣的錯誤Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\exportword2.php:216) in C:\xampp\htdocs\test\exportword2.php on line 217Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\exportword2.php:216) in C:\xampp\htdocs\test\exportword2.php on line 218Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\exportword2.php:216) in C:\xampp\htdocs\test\exportword2.php on line 219Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\exportword2.php:216) in C:\xampp\htdocs\test\exportword2.php on line 220這是我的代碼        <tr>            <td>13. </td>            <td>Upah Pekerja</td>            <td>:</td>            <td>Minimum</td>            <td colspan="4">Rp. 100000</td>        </tr>        <tr>            <td></td>            <td></td>            <td>:</td>            <td>Maximum</td>            <td colspan="4">Rp. 100000</td>        </tr>        <tr>            <td></td>            <td>Upah Pekerja Harian</td>            <td>:</td>            <td>Minimum</td>            <td colspan="4">Rp. 100000</td>        </tr>        <tr>            <td></td>            <td></td>            <td>:</td>            <td>Maximum</td>            <td colspan="4">Rp. 100000</td>        </tr>        <tr>            <td>14.</td>            <td>Sistem Hubungan Kerja</td>            <td colspan="6">:</td>        </tr>        <tr>            <td></td>            <td>a. Untuk Waktu Tertentu</td>            <td colspan="6">: 3 Orang</td>        </tr>        <tr>            <td></td>            <td>b. Untuk Waktu Tidak Tertentu</td>            <td colspan="6">: 3 Orang</td>        </tr>    </table>我已經完成導出,直到我添加新的表行,我收到上面的錯誤
查看完整描述

1 回答

?
aluckdog

TA貢獻1847條經驗 獲得超7個贊

請參閱文檔:

header() 必須在發送任何實際輸出之前調用,無論是通過正常的 HTML 標簽、文件中的空行還是從 PHP 發送。使用 include、require、函數或其他文件訪問函數讀取代碼,并在調用 header() 之前輸出空格或空行是一個非常常見的錯誤。使用單個 PHP/HTML 文件時也存在同樣的問題。

<?php

// header must be before any sent output?

header("Content-Type: application/vnd.msword");

header("Expires: 0");

header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

header("content-disposition: attachment;filename=hasilekspor.doc");

??>

<html>

...

</html>


查看完整回答
反對 回復 2023-09-22
  • 1 回答
  • 0 關注
  • 102 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號