在文件管理中,为了将文件移动到另一个文件夹,我试图计算文件夹中已存在的文件数.
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输出数量?