我正在尝试显示我的文件夹的内容。我在该文件夹中有4个文件,其中2个正在显示,另外两个正在给我2个警告:
我的代码:
// Opens directory
if(isset($_GET['tacheep'])){
$a1=$_GET['tacheep'];
$chemin=("./documents/etudep/$a1");
}
if(isset($_GET['tachee'])){
$a1=$_GET['tachee'];
$chemin=("./documents/etude/$a1");
}
if(isset($_GET['taches'])){
$a1=$_GET['taches'];
$chemin=("./documents/suivi/$a1");
}
$myDirectory=opendir($chemin);
// Gets each entry
while($entryName=readdir($myDirectory)) {
$dirArray[]=$entryName;
}
// Finds extensions of files
function findexts ($filename) {
$filename=strtolower($filename);
$exts=explode(".", $filename);
$n=count($exts)-1;
$exts=$exts[$n];
return $exts;
}
// Closes directory
closedir($myDirectory);
// Counts elements in array
$indexCount=count($dirArray);
// Sorts files
sort($dirArray);
// Loops through the array of files
for($index=0; $index < $indexCount; $index++) {
// Gets File Names
$name=$dirArray[$index];
$namehref=$dirArray[$index];
// Gets Extensions
$extn=findexts($dirArray[$index]);
// Gets file size
$size=number_format(filesize($dirArray[$index]));
// Gets Date Modified Data
$modtime=date("M j Y g:i A", filemtime($dirArray[$index]));
$timekey=date("YmdHis", filemtime($dirArray[$index]));