第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何修復(fù) PHP 中的“警告:

如何修復(fù) PHP 中的“警告:

PHP
慕田峪9158850 2021-06-30 09:43:58
執(zhí)行下面的代碼時(shí),它返回錯(cuò)誤“警告無(wú)法修改標(biāo)頭信息 - 標(biāo)頭已由......發(fā)送”。我已經(jīng)編寫(xiě)了以 2 種不同方式提取數(shù)據(jù)的數(shù)組,但仍然收到問(wèn)題。<?php  //export.php      $connect = mysqli_connect("localhost", "username", "password", "dbname");    $output = '';    if(isset($_POST["export"])){        $query = "        select trim(ifnull(application, 'Grand Total' )) as Application,         ifnull(sum(Totalcapacity) ,0.00) as 'Capacity (Gig)'        from storagedata group by application with rollup         ";        $result1 = mysqli_query($connect, $query);        $result2 = mysqli_query($connect, $query);        $dataRow = "";        while($row2 = mysqli_fetch_array($result2)){        $dataRow = $dataRow."<tr><td>$row2[0]</td><td>$row2[1]</td></tr>";}?><html><head>        <title>Returning Total Capacity Per DC</title></head><body><!-- Building table -->        <table align = 'center' border='2' width='300' height='100'>            <tr>            <td colspan='2' align='center' bgcolor='lightblue'><b>Total Capacity by DC</b> </td>            </tr>            <tr>                <th>Datacenter</th>                <th>Total Capacity (Gig)</th>            </tr>            <?php while($row1 = mysqli_fetch_array($result1)):;?>            <tr>                <td><?php echo $row1[0];?></td>                <td><?php echo $row1[1];?></td>            </tr>            <?php endwhile;?></body>     <br><br><?php  $output .= '</table>';  header('Content-Type: application/xlsx;');  header('Content-Disposition: attachment; filename=download.xlsx');  echo $output;  }?>當(dāng)單擊我的導(dǎo)出按鈕時(shí),它應(yīng)該導(dǎo)出數(shù)據(jù)。同樣的代碼也適用于其他“報(bào)告”。唯一的區(qū)別是頂部的選擇查詢(xún)。
查看完整描述

1 回答

?
慕標(biāo)琳琳

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超9個(gè)贊

地方:


header('Content-Type: application/xlsx;');

header('Content-Disposition: attachment; filename=download.xlsx');

在腳本的開(kāi)頭。


<?php

header('Content-Type: application/xlsx;');

header('Content-Disposition: attachment; filename=download.xlsx');


//...

并確保


<?php

位于文件的最開(kāi)頭,之前沒(méi)有行或空格。


在您的腳本發(fā)送了一些輸出之后,您將無(wú)法更改標(biāo)頭設(shè)置。


查看完整回答
反對(duì) 回復(fù) 2021-07-02
  • 1 回答
  • 0 關(guān)注
  • 126 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)