Jump to content

Php Include File


Chikwado

Recommended Posts

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 by Chikwado
Link to comment
Share on other sites

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

it just means move up 2 (two) directories

That 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...