Some people like to make a list of slash, such as $ dir = dirname (__ FILE__). '/';
Some people find it troublesome and code is not good, directly with $ dir = dirname (__FILE__);
So when we want to include files there may be problems.
For example, to include test.php, if it is dirname (__FILE__). '/test.php', of course no problem, if there is no slash, such as dirname (__ FILE__). 'Test.php', then the problem is coming Find D: webtest.php becomes D: webtest.php.
solution:
Directory constants or variables used ./ instead /
such as:
include 'D: /web./test.php';
include 'D: / web /./test.php';
All equal
include 'D: /web/test.php';
This eliminates the need to consider whether the directory name is added /, and when using constants or variables to get the directory, the display will be more intuitive.
Such as:
define ('ROOT_PATH', dirname (__ FILE__). '/');
include ROOT_PATH. './test.php';
ratio
include ROOT_PATH. '/test.php';
include ROOT_PATH. 'test.php';
Easier to intuitively determine the file as a file under ROOT_PATH