문제

I have a txt file that I need to access via fopen that is located at /etc/company/lastID.txt via the following script:

$dataFile = "/etc/company/lastID.txt";
$fh = fopen($dataFile, "r");

print_r(error_get_last());

$lastID = fread($fh, filesize($dataFile));
fclose($fh);

The error I am receiving is:

fopen(/etc/company/lastID.txt): failed to open stream: No such file or directory

but the file is definitely there. When I call another file in the same directory using require_once it is read without issue, only when I use fopen do I seem to have a problem.

Any thoughts?

도움이 되었습니까?

해결책

What's happen when you try to read another file in /etc/company directory? This error means file doesn't exits.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top