[請益] 如何對Content-Disposition標頭加下載標題?

作者: red0whale (red whale)   2016-05-22 16:02:15
<?php
$file="test.pdf";
$url="http://www.example.com/download/";
header("Content-type:application");
header("Content-Disposition: attachment; filename=".$file);
readfile($url.str_replace("@","",$file));
?>
假設我有一個PDF檔叫test.pdf,該檔存在http://www.example.com/download/裡面
今天如果有人點進了這個PHP頁面裡頭,就會自動下載這個PDF檔案
我的這個頁面被Google的「爬蟲」找到了,並被放在他們的搜尋引擎資料庫裡
但是問題在:他們顯示出來的結果標題居然顯示「Untitled」,而且沒有說明內容
明明我原先的PDF檔(test.pdf)有標題啊,
為什麼他們搜尋出來的結果卻是沒有標題和說明內容呢?
請各位幫我解惑一下…
謝謝

Links booklink

Contact Us: admin [ a t ] ucptt.com