Chikwado Posted October 24, 2015 Share Posted October 24, 2015 (edited) Can some one help explain what I did here, <?php include_once('../../library.php'); /*testing include file now*/ require_once('../../file/file1/page.php); ?> I use to see a file been positioned like this, but could not understand what they did. What is the meaning of several dot and forward slash across before the name of library file? Can some one explain more? Edited November 5, 2015 by Chikwado Link to comment Share on other sites More sharing options...
Ingolme Posted October 24, 2015 Share Posted October 24, 2015 That's not a programming thing. In any filesystem, "." refers to the current directory and ".." refers to the parent directory. Link to comment Share on other sites More sharing options...
Chikwado Posted October 24, 2015 Author Share Posted October 24, 2015 Yes, "." is for current directory and ".." is parent directory. Ok what of other double dot Example: include('../../file.php'); How many directory are here now? Link to comment Share on other sites More sharing options...
dsonesuk Posted October 24, 2015 Share Posted October 24, 2015 There could several, each '../' represent moving outside current directory to its parent directory relative from where the current file is located which is using the includeParentonedir/File1.phpFile2.phpSubparentdir/file.phpFile1.phpFile2.phpSubsubdirectoryFile1.phpFile2.phpSubsubsubdirectoryFile1.phpFile2.phpFile3WithInclude.phpEven though there are four directories (could be many more) a parent with sub directory within sub direcotories and so on, File3WithInclude.php is only looking for a specific file (file.php) 2 parent directories above it, relative to its current location so you don't require directory name, which is only ever required when you need to search a sub directory of last uppermost parent, then you would include tbat folder name before required file name.‘../../specificSubDirectory/file.php' Link to comment Share on other sites More sharing options...
thescientist Posted October 29, 2015 Share Posted October 29, 2015 it just means move up 2 (two) directories Link to comment Share on other sites More sharing options...
dsonesuk Posted October 29, 2015 Share Posted October 29, 2015 it just means move up 2 (two) directoriesThat is misleading, you could be suggesting current file with 2 or 3 directories at same location that it moves to the 2nd directory, which makes it more confusing depending where you start from? First or third directory?, what if its sorted ascending or descending :-S.It moves from current directory to the parent directory of this current directory (that is 1), it then again repeats the same steps moving to next parent directory(2), and if the target file is here it will load it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now