knot22 Posted June 3, 2013 Share Posted June 3, 2013 Hi - While working through the ch. 2 script examples, and simultaneously working on separate a website project, I noticed a subtle difference in strings provided to require(). Here is an example: require ('Includes/Config.php'); vs. require ('./Includes/Config.php'); The second command contains a period and forward slash before the folder and file are stated. As far as I can tell, the web page behaves the same no matter which string is provided to require(). What does "./" mean? What is the purpose of prefixing the required file string with "./"? I'm guessing it has something to do with folder structure... Link to comment Share on other sites More sharing options...
HartleySan Posted June 4, 2013 Share Posted June 4, 2013 The single period (.) refers to the current directory in UNIX systems (http://en.wikipedia.org/wiki/Working_directory). I can't think of any cases in which specifying ./ before a relative path vs. just the relative path would make a difference, but maybe there is one. I used to specify ./ before relative paths to be more precise, but as far as I could tell, it didn't affect anything, so I stopped doing it. Link to comment Share on other sites More sharing options...
Recommended Posts