开发者

php change directory to base directory

i change the dir to the current file directory to :

chdir(dirname(__FILE__));

开发者_Go百科But how do i change it back to the base director like / in linux and say C: in windows i dont know that is the OS of the user.

Is there a way to do it in both linux and win ?


PHP will translate directory separators for you, so just chdir('/') will work on both. However, you'd have to account for Windows drive names, as there's no such thing on Unix systems.


The answer to this question: How to get the OS on which PHP is running? might help you determine the OS.

Try using php_uname()

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜