【问题标题】:What is the "." parameter in php? [duplicate]是什么 ”。” php中的参数? [复制]
【发布时间】:2016-01-25 17:45:46
【问题描述】:
<?php
$dit = new DirectoryIterator('.');
while ($dit->valid()) {
    if (!$dit->isDot()) {
        echo $dit->getFilename() . "\n";
    }
    $dit->next();
}
unset($dit); 
?>

'.' 是什么意思DirectoryIterator 方法中的参数均值?

【问题讨论】:

  • 你考虑过reading the manual吗?
  • 点代表当前目录,但是是的,请阅读手册。
  • 是的@Quentin 我只是 php 的初学者。

标签: php


【解决方案1】:

参数告诉它要迭代哪个目录。

. 是“当前目录”的相对路径

【讨论】:

    【解决方案2】:

    在每个操作系统上,. 表示当前目录,.. 表示父目录。

    【讨论】:

      猜你喜欢
      • 2013-01-22
      • 2021-11-16
      • 2014-07-26
      • 1970-01-01
      • 2016-01-09
      • 2017-10-18
      • 2019-06-07
      • 2023-03-17
      • 2019-01-14
      相关资源
      最近更新 更多