php - 读取目录不在文件系统顺序中
问题描述
我有这个代码:
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
print_r(" ".$file. " ");
$data = array(
'emplacement' => 'uploads/slidesFiles/'.$file
);
$jpgId = $CI->dataaccess::InsertJpg($data);
$data = array(
'idSlideZip' => $zipId,
'idSlideJpg' =>$jpgId
);
$CI->dataaccess::InsertJpgToSlide($data);
}
closedir($dh);
}
}
我的文件夹:
但是当我使用 read dir 函数循环进入我的文件夹时,我没有预期的顺序是下一个:
我尝试使用排序功能重新排序,但这不是预期的结果。
任何想法 ?
解决方案
推荐阅读
- html - 将视频嵌入 HTML
- r - 尝试在 Shiny App 中使用 RMarkdown 下载 PDF
- r - ggplot scatter 创建统一点
- python - 为什么除了 NameError 没有在我的代码中提取名称错误?
- amazon-ec2 - 在没有 SSH 密钥的情况下从 gitlab runner 在 ec2 实例上运行 ansible?
- jquery - 在我的结帐中实施了 Stripe v3 卡片元素,并且 jquery 停止工作
- typescript - 与泛型函数一起使用的接口的默认值
- firebase - 我可以使用自定义声明设置一个名为“已禁用”的标志吗?
- mysql - 在非主键列上分区 mysql 表
- javascript - jQuery UI 自动完成中的“值”与“标签”