简体   繁体   English

PHP scandir如何工作?

[英]How does PHP scandir work?

I need to scan directory /home/user/www/site/public_html/application (full path by root). 我需要扫描目录/home/user/www/site/public_html/application (通过root的完整路径)。
scandir does perform it with even just 'application' part of full path as argument and that's all going to be ok, I got now list of files and directories as result. scandir甚至仅'application'完整路径的'application'部分作为参数来执行它,这一切都OK,现在我得到了文件和目录的列表。
I am interesting how scandir does work with that path 'application' ? 我很有趣,scandir如何与该路径'application' Ain't the argument should be a full path by root ? 该论点不是应该是full path by rootfull path by root吗?
I did not found any explanation to this behavior on official php.net, unfortunately. 不幸的是,我没有在官方php.net上找到对此行为的任何解释。
Any idea, how it works? 任何想法,它是如何工作的? Thanks. 谢谢。

PS My DOCUMENT_ROOT is set to /home/user/www/site/public_html PS我的DOCUMENT_ROOT设置为/home/user/www/site/public_html

对于相对路径,它基于脚本的当前工作目录,您可以在getcwd找到该目录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM