php : Cannot reference current's file parent's folder subdirectory!
Please help!
My directory structure is this:
my_application
my_application/index.php
my_application/images
my_application/phpcode/my_script.php
I have this code in my_script.php
<?php
if(file_exists('../images)){
// do something
}
?>
It works in wamp perfectly!!!
But when I upload it to my server (ho开发者_StackOverflowstgator), it doesn't work.
In my server I do not upload it to root folder, but to a subfolder.
rootfolder/folder1/folder2/my_application
From what I understand, .. is in reference to the root path, not the current file.
How can I reference the current's file parent's folder images?
Sorry for my English. Please help! I'm stuck on this one.
You can simpli use dirname($SCRIPT_FILENAME)
to reference the direcotry of your current script.
Have a look at PHP Constant and PHP Reserved Variable :)
Hope this help
精彩评论