Reputation: 928
So I have a directory such as:
Something
|_ Setup.php
|_ development.php
Inside of Setup.php
I did the following:
if(file_exists('development.php')){
// do something.
}
But the issue is that it never sees the development.php
file, when I do an else{}
statement to see if maybe I spelt it wrong it goes straight to the else statement.
How does this file NOT exist? It's spelt properly, am I missing something?
Upvotes: 0
Views: 86
Reputation: 10003
Your working directory is probably not what you think it is.
Try using the __DIR__
magic constant:
if(file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'development.php')){
// do something.
}
Your PHP file's parent directory will be substituted where __DIR__
appears.
Upvotes: 1