When I use the function var_dump, in my file php, It doesn't print the array like before. I haven't touched the file php.ini in my wampserver,
function getFolder_recursive(&$array,$dir){
if(is_dir($dir)){
$handle=opendir($dir);
while (false!== ($entry=readdir($handle))) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir.$entry)){
$allFiles[]= "D: " . $dir . "/" . $entry;
// echo "<a href='http://localhost/eclipse/access_log/logfiles.php?cartella=$c' class='btn btn-light>Cartella</a>";
}
else{
$allFiles[]="F: " . $dir . "/" . $entry;
}
}
}
closedir($handle);
--> var_dump($allFiles);
}
return $array;
}
This is how it prints:
array(7) { [0]=> string(22) "D: files/log_files//10" [1]=> string(21) "D: files/log_files//2" [2]=> string(21) "D: files/log_files//3" [3]=> string(21) "D: files/log_files//4" [4]=> string(21) "D: files/log_files//6" [5]=> string(21) "D: files/log_files//7" [6]=> string(21) "D: files/log_files//
I expect that var_dump prints my array formatted
Just add <pre>
tags
function getFolder_recursive(&$array,$dir){
if(is_dir($dir)){
$handle=opendir($dir);
while (false!== ($entry=readdir($handle))) {
if ($entry != "." && $entry != "..") {
if (is_dir($dir.$entry)){
$allFiles[]= "D: " . $dir . "/" . $entry;
// echo "<a href='http://localhost/eclipse/access_log/logfiles.php?cartella=$c' class='btn btn-light>Cartella</a>";
}
else{
$allFiles[]="F: " . $dir . "/" . $entry;
}
}
}
closedir($handle);
echo "<pre>";
var_dump($allFiles);
echo "</pre>"
}
return $array;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.