Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$title is deprecated in /home/www/dev/work/website/lvesu/class/controller/blog/php.php on line 28

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/php.manual.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
PHP - Manual: Directory::read - 互联网笔记

略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Directory::read

2025-04-27

Directory::read

(PHP 4, PHP 5, PHP 7, PHP 8)

Directory::read从目录句柄中读取条目

说明

public Directory::read(): string|false

更新日志

版本 说明
8.0.0 不接受任何参数。在此之前,目录句柄可以作为参数传递。
添加备注

用户贡献的备注 2 notes

up
1
matschek at gmx dot de
4 months ago
<?php while ($row=$dir->read()) ?>
// will break as soon as $row can be casted to false, which is the case for a directory named "0"

<?php while (false !== ($row=$dir->read())) ?>
// will do the job as expected
up
-4
cjcxxh at 163 dot com
1 year ago
use
while ($row=$dir->read()){
// your code
}
to get a list of all files and directories. You can definitely use the "for" and other loops.

官方地址:https://www.php.net/manual/en/directory.read.php

冷却塔厂家 广告
中文GPT4.0无需注册 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3