douyan3478
2016-11-30 10:15
浏览 22
已采纳

用php获取当前目录的路径?

I'd like to get the correct php code to display filepath to a folder on my server. Currently I put the actual filepath in my script which looks like this: /home/username/mydomain.com/dir/upload/

So the script is installed in a subfolder "dir", and I need the path to the "upload" folder

I used this, but it doesn't seem to work, because it seems to put uploaded files into the root:

$_SERVER["DOCUMENT_ROOT"] . '/upload' 

图片转代码服务由CSDN问答提供 功能建议

我想获得正确的php代码来显示我服务器上文件夹的文件路径。 目前我把实际的文件路径放在我的脚本中,如下所示:/home/username/mydomain.com/dir/upload/

nnn

所以脚本安装在子文件夹“dir”中, 我需要“上传”文件夹的路径</ p>

我用过这个,但它似乎不起作用,因为它似乎把上传的文件放到根目录中:</ p>

  $ _ SERVER [“DOCUMENT_ROOT”]。  '/ upload'
 </ code> </ pre> 
 </ div>

1条回答 默认 最新

相关推荐 更多相似问题