Header有沒有辦法向頁面寫入title標題

來源:互聯網
上載者:User
以下是部分代碼,現在開啟頁面時,頁面中有內容,不過頁面的title是網址,怎麼寫入這個標題。

Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($pagename));
Header("Content-Disposition: attachment; filename=".iconv("utf-8", "gb2312", $r[title]).".txt");


回複討論(解決方案)

你這不是檔案下載嗎?

是檔案下載,我看到百度收錄的頁面中全是網址,沒有標題, 所以工想加標題。

加不了標題的 因為title是檔案內容

開啟一個新的頁面下載 把title傳到$title即可

開啟一個新的頁面下載 把title傳到$title即可

header所做的工作一般是指http協議的header,而不是html文檔的header,釐清這個概念吧

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.