To get the username of the account:
<?php
$dir = getcwd();
$part = explode('/', $dir);
$username = $part[1];
?>
If current directory is '/home/mike/public_html/' it would return mike.
![]() | getcwd返回值成功则返回当前工作目录,失败返回 FALSE。 在某些 Unix 的变种下,如果任何父目录没有设定可读或搜索模式,即使当前目录设定了,getcwd() 还是会返回 FALSE。有关模式与权限的更多信息见 chmod()。 ![]()
emailfire at gmail dot com
08-Dec-2005 10:57
To get the username of the account:
memandeemail at gmail dot com
07-Dec-2005 07:48
Some server's has security options to block the getcwd()
marcus at synchromedia dot co dot uk
04-May-2005 11:41
"On some Unix variants, getcwd() will return FALSE if any one of the parent directories does not have the readable or search mode set, even if the current directory does."
vermicin at antispam dot gmail dot com
27-Jan-2005 07:48
If your PHP cli binary is built as a cgi binary (check with php_sapi_name), the cwd functions differently than you might expect.
manux at manux dot org
22-Jun-2004 12:44
watch out:
dave at corecomm dot us
11-Dec-2003 02:14
getcwd() returns the path of the "main" script referenced in the URL.
fvu at wanadoo dot nl
24-Nov-2003 09:50
Make sure to lowercase the result before comparing Windows paths, because this function returns ambiguous results on Windows. From within Apache, the returned path is lowercase, while from the command line interface (CLI) the returned path uses the 'real' Windows pathname. For example, running the 'print getcwd();' command from 'C:\Program Files' returns either
raja at rajashahed dot com
07-Nov-2003 02:21
This is current working directory. X example, your document root is c:\Inetpub\www\htdocs. When You need to know what is your doc_root; /* Like ask yourself your name ;)*/ | ![]() |