PHP 文件目录 - $_SERVER['DOCUMENT_ROOT'] 的父文件夹
我知道 $_SERVER['DOCUMENT_ROOT'] 返回文档根目录(很可能类似于 /home/user/public_html),但是有没有办法获取此文件夹的父目录? (即只是 /home/user/ )
我会尝试替换公共文件夹名称,例如 public_html 或 www,但这并不是说该文件夹将在我希望此代码运行的所有系统上命名。
仅供参考:我正在尝试实现 this,但我希望用户能够选择他们的 FTP 根目录文件夹,它通常是文档根文件夹的父文件夹。
有什么想法吗?
I know $_SERVER['DOCUMENT_ROOT'] returns the document root (most likely something like /home/user/public_html), but is there any way to get the parent directory of this folder? (i.e. just /home/user/)
I would try and replace common folder names like public_html or www, but it's not a given that the folder would be named that on all systems I want this code to run on.
FYI: I'm trying to implement this, but i want the user to be able to select their FTP root folder, which is most commonly the parent of the Document Root folder.
Any thoughts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)