【发布时间】:2013-03-23 22:06:26
【问题描述】:
这是我的代码:
foreach ($positions as $position)
{
print("<tr>");
print("<td>{$position["Post Date"]}</td>");
print("<td>{$position["Description"]}</td>");
print("<td>{$position["Link"]}</td>"); //shows location of the file
print("<td>{$position["File Name"]}</td>");
$file = rawurlencode($position["File Name"]);
print("<td><input type=button name=open value='Open File'
onclick=window.open(...);></td>"); // missing code to open pdf
print("</tr>");
}
?>
我正在创建一个表格,列出下载到特定目录 (localhost/pdfs/*.pdf) 的所有 pdf 文件。在以表格形式列出所有文件的页面上列出的文件名旁边,我有一个按钮,单击该按钮应打开该 pdf 文件。为什么是按钮?因为我前几天尝试将该文件名设置为链接,但没有成功……所以我有两个问题:
- 如果您对此有解决方案,更优雅的方法是通过链接打开该文件...
- 让我的按钮工作...文件可以使用标准 pdf 查看器打开,无需在浏览器中。
我们将不胜感激。
【问题讨论】:
标签: php pdf button html-table