【发布时间】:2017-01-08 10:55:47
【问题描述】:
我在一个带有 Linux、Apache 和 php 5.2.17 且 allow_url_fopen=true 的托管站点上,一个 php 页面使用 fopen (fopen($_SESSION['IMG_DIR_REL']."/ img/img5.jpg", "rb")); 我不使用 file_exists 因为它返回 "nothing" :-( . 该页面位于子目录 ./test/ 上,图像位于子目录 ./img/ 上 如果我使用 http (http://www.example.com/test/control.php) 访问该页面,则 fopen 可以完美地提供正确的图像存在。 但是,如果我使用 https (https://www.example.com/test/control.php) 访问同一页面,我得到 fopen(https://www.example.com/img/img5.jpg) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.1 403 禁止。 如果我改为 fopen (fopen("../img/img5.jpg", "rb"));它适用于https。 我用谷歌搜索了一下,测试了一些类似案例的例子,但没有任何效果。 你有什么建议吗? 提前致谢。
【问题讨论】: