選擇文件名和重定向..PHP - 如何給PDF閱讀路徑?
的index.php
<?php
$book_name = ["Jenkins_Essentials","Asterisk","phalcon"];
echo "<select><option selected>Book Name</option>";
foreach ($book_name as $key => $value) {
echo "<option name='$key'>$value</option>";
}
echo "</select>";
?>
<script type="text/javascript">
$(document).ready(function(){
$("select").on("change",function(){
location.href = "reading.php?title="+$(this).val();
});
});
</script>
reading.php
$title = $_GET["title"];
header("Content-type: application/pdf");
header('Content-Disposition: inline; filename="$title.pdf"');
@readfile('D:\Learning\$title.pdf');//this is my issue
當我重定向它表明Failed to load PDF document
.. 我運行腳本文件位置正如我們所知C:\xampp\htdocs
但是pdf文件的地方如上所示D:
驅動器!如何給它路徑?
沒有php有權訪問該目錄? –
在調試階段,千萬不要用'@'來壓制警告。去掉它。 – Raptor