Php readfile不'';URL路径无效
我使用readfile来读取文件,但它不适用于URL路径。所以,我给出了它的物理路径。如何使用URL路径Php readfile不'';URL路径无效,php,readfile,Php,Readfile,我使用readfile来读取文件,但它不适用于URL路径。所以,我给出了它的物理路径。如何使用URL路径 header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" . basename($path) . "\""); readfile($path);
header('Content-Type: application/octet-stream');
header("Content-Transfer-Encoding: Binary");
header("Content-disposition: attachment; filename=\"" . basename($path) . "\"");
readfile($path);
如果php.ini已启用名为
allow_url_fopen=On
然后url基本路径将在readfile中工作,否则您将不得不使用fopen
谢谢
Amit因此,如果“允许url\u fopen”选项未启用,则您需要将readfile函数更改为fopen。谢谢。这也是一个权限问题吗?这也可能是权限问题,但首先我们应该检查的是allow_url_fopen=On,如果是一个,然后检查权限,如果更新代码以使用fopen而不是readfile仍然不起作用。这个问题的答案对您有效吗?