in PHP by (15.1k points)
0 like 0 dislike
15 views

How I can to get current directory path in PHP?

Suitable search queries for this question
  • php get current directory
  • php path to current directory

1 Answer

0 like 0 dislike
by (15.1k points)

Use for this predefined magic constants __FILE__ and __DIR__:

$dir = dirname(__FILE__) . '/';

or:

$dir = __DIR__ . DIRECTORY_SEPARATOR;

Please log in or register to answer this question.