PHP traverses the files in the folder and obtains the inputname value ,. PHP traverses the files in the folder and obtains the inputname value ,? Php $ dirdirname (_ FILE _); name of the directory to be traversed-the folder where the current FILE is located $ dirD: PHPwampwwwadmin PHP traverses the FILE in the folder and obtains the value of input name,
$ Dir = dirname (_ FILE _); // name of the directory to be traversed-> the folder where the current FILE is located
// $ Dir = 'd: \ PHP \ wamp \ www \ admin \ hosts \ admin ';
// PHP traverses all files in the folder
$ Handle = opendir ($ dir .".");
$ Arr = array ();
While ($ file = readdir ($ handle )){
If (is_file ($ file )){
If ($ file! = "." & $ File! = ".."){
$ File = mb_substr ($ file, 0, strripos ($ file ,'.'));
$ Files = explode ('', $ file); // Convert $ file to an array
$ Arr [] = $ files ['0']; // Convert to a one-dimensional array
}
}
}
// Print_r ($ arr );
Closedir ($ handle );
// PHP retrieves the value of input-> name
Foreach ($ _ post as $ key => $ value ){
If (! In_array ($ key, $ arr) {// judge whether the name value is not in $ arr
Echo "$ key: Nonexistent ";
}
}
?>
Test