php - 如何显示非公共网站文件夹中的 .pdf 文件?
问题描述
我在网站的非公共文件夹中有几个 .pdf 文件。该文件夹名为“protected”,与 public_html 文件夹位于同一文件夹中。所有网站页面都是 .php 文件。
以下 HTML 代码正确显示 .txt 文件的内容:
<form method="post" action="../protected/documents/test.txt">
<input name="submit1" type="submit" value="Text File" />
<br>
</form>
以下代码返回 404 错误:
<form method="post" action="../protected/test.pdf">
<input name="submit2" type="submit" value="PDF File" />
<br>
</form>
为什么 .txt 文件可以正常显示而 .pdf 文件不能正常显示?
解决方案
你试过了吗
<a href="./protected/test.txt" target="_blank">TXT File</a>
<a href="./protected/test.pdf" target="_blank">PDF File</a>
推荐阅读
- php - 用 php 更新数据库中的图像名称
- c - 简单矩形法算法问题
- android - Flutter StreamBuilder 错误类型“Null”不是“Map”类型的子类型
' 在类型转换中 - google-apps-script - 点替换用 replaceText 应用脚本 google 文档(不是工作表)
- c++ - clang sanitisers 会检查未初始化的内存吗?
- java - 打开 DeepSpeech 模型时出现问题:“E/tflite:无法打开 '/storage/emulated/0/Download/deepspeech-0.9.3-models.tflite'。”
- codeigniter - ci4 使用保存时插入或更新的先决条件是什么
- pygame - pygame 中的表面是否包含超过它可以显示的内容(在 20x20 表面上加载 40x40 图片)?
- python - Python readline 将我的打印定位在下面而不是旁边
- google-chrome - 如何使警报窗口也播放声音