I am trying to look for a file called test.txt
within the folder called .test
.
<?php
$path = '/localhost/joshcms/.test/test.txt';
$fileexists = file_exists($path);
if ($fileexists == '1') {
$result = 'true';
} else {
$result = 'false';
}
?>
Please excuse the horrible formatting, I am creating this PHP within Jade.
I, first of all, had the $path
variable set to .test/test.txt
so when it searched for the file, it looked in: localhost/joshcms/.test/test.txt
because it was a relative path; because that never worked, I then changed the code to look the way it is above and yet, it still does not work. I then tried with a file that was in the same folder and that worked fine.
I'm not too sure if this error is occurring due to me trying to find something in a hidden folder or if it's just the function doesn't work unless the file is in the same directory as the PHP script/file itself.