php - include file(s) from another directory -


Currently I'm trying to include one PHP file from another file.

  public_html / a / class / test.php & lt; - From this file I can see public_html / b / common.php & lt; I want to include a file from - I want to include this file  

Make sure what I should do because I

  dirname (__ FILE__)  

and it is public_html /

  dirname (__ file __). '/ .. / b / common.php'     / code>  

but it does not help me in getting my file.

You can proceed to the directory tree until you have an ordinary ancestor: / P>

  is required dirname (dirname (__DIR__)). '/b/common.php';  

The magic was introduced in continuous __dir __ equal to dirname (__file __) , and 5.3. Each use of dirname () goes back to a directory, i.e.:

  dirname ('public_html / a / class'); // public_html / one dime ('public_html / a'); // public_html  

BTW, Emptors, such as PHPStorm also understand this use of relative path.


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -