小编mud*_*aya的帖子

如何计算文件夹中已存在的文件数

在文件管理中,为了将文件移动到另一个文件夹,我试图计算文件夹中已存在的文件数.

foreach($checkboxfiles as $checkboxfile) {
    $src_file = $checkboxfile;
    $fileName = basename($src_file);
    $new_dest = $_POST['cbdestination'];

    /* New path for this file */
    $dest_file = $MainFolderName.'/'. $new_dest . '/' . $fileName;

    echo count(file_exists($dest_file)); //this should give me the number of files which already exists
Run Code Online (Sandbox Code Playgroud)

由于2个文件已存在,因此回声产生

11
11
Run Code Online (Sandbox Code Playgroud)

作为输出.我如何实现2输出数量?

php arrays foreach count

0
推荐指数
1
解决办法
63
查看次数

标签 统计

arrays ×1

count ×1

foreach ×1

php ×1