Answer the question
In order to leave comments, you need to log in
How to check if a PHP directory exists?
Why is this code not working?
if (is_dir($_SERVER['DOCUMENT_ROOT'] . "/base/$keygen")) {
echo "Эта папка существует";
} else {
echo "Этой папки нет";
}
Answer the question
In order to leave comments, you need to log in
Goodnight.
The code is quite working.
Do I understand correctly that the api and base directories are on the same level?
What exactly doesn't work for you?
Check that the $keygen variable is empty.
Check what generally returns $_SERVER['DOCUMENT_ROOT'] . "/base/$keygen"
, maybe not the right way.
And in general, take a look at the server logs, maybe you have an error lying around somewhere and it is not displayed in the browser.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question