无法在服务器上打开文件

时间:2016-06-27 09:48:27

标签: php file

Warning: fopen(..\articles\Bs37NLAXiPOWBKZwy5XByIAMAO25ln05.txt): failed to open stream: No such file or directory in /home/******/public_html/abcd/index.php on line 19 Unable to open file!

在服务器上打开txt文件时出现此错误

3 个答案:

答案 0 :(得分:0)

该文件不存在。

检查路径和文件名,确保它对于正在执行脚本的用户是可存在的和可访问的。

分享您的文件夹结构,以便为您提供进一步的帮助。

答案 1 :(得分:0)

您正在使用的代码是尝试使用Windows路径" .. \ articles \ Bs37NLAXiPOWBKZwy5XByIAMAO25ln05.txt"不是unix路径,如错误所示。

答案 2 :(得分:0)

在打开文件之前检查文件是否存在:

if (file_exists($path)) {
    fopen($path);
} else {
    echo "File is not exists";
}
相关问题