开发者

directory path question

What is the difference between:

include("./somepath/class开发者_开发技巧.php");

and

include("somepath/class.php");


There shouldn't be any difference, directory wise, since the former assumes relative directory structure. The only potential pitfall could be if "somepath" were actually a command to be run - some users expect to type a command for a local script file and assume it should run, when you actually have to run "./somepath" to invoke it. This, of course, only pertains to commands not on your $PATH.


I don't see any difference. "." means current directory.


. refers to the current working directory.

Sometimes you want to specify explicitly that what you want is in the current working directory, and that it is not from something in your path variable for example.


For example in PHP "somepath/somefile" is appended after paths specified in include_dir (for example: /home/var/; /home/bin/ ....) directive.

The second variant is more specific it says: search in current directory!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜