php:如何修复''Array()''? 我试图从文件夹中的每个单独的文件中获取内容

    <?php

        function cmp($a, $b) {
            if (filemtime($a) == filemtime($b))
                return 0;

            return (filemtime($a) < filemtime($b)) ? -1 : 1;
        }


        $files = glob("/Users/xx/Desktop/2011/cdr/*.cdr");
        usort($files, "cmp");

        foreach($files as $file)

            //echo $file . "<br />";
            // echo "$file was last modified: " . date ("d-m-Y H:i:s.", filemtime($file))."
";


    $file1 = file_get_contents($file, FILE_USE_INCLUDE_PATH);


    $arr1 = explode("
", $file1);


    $data1 = array();



     foreach ($arr1 as $key => $value) {
 $split = explode(";", $value);

 $keys = md5(uniqid(rand(), true));
}
 print_r($data1);
?>

I am trying to get contents from each file but it keep getting below

Array ( )

Question is how can i fix the error when am trying to get contents from each individual file in a folder? Should i make a loop to read from each file separately ?

$files = glob("/Users/xx/Desktop/2011/cdr/*.cdr");

This call to glob() will return an array of absolute paths like:

"/Users/xx/Desktop/2011/cdr/example.cdr"

The path is part of the returned value! (This is unlike some other functions like readdir().) You don't need to append the path again when you call file_get_contents().