Jump to content

scandir()


The Little Guy

Recommended Posts

Why does this work:
[code]<?php
$dir = $_SERVER['DOCUMENT_ROOT'].'/tzfiles';
$files = scandir($dir, 1);
foreach($files as $file){
if(is_dir($file) && $file != '.' && $file != '..'){
echo '<strong class="bigger">'.$file.'</strong>';
}
}
?>[/code]

But this doesn't:
[code]<?php
$dir = $_SERVER['DOCUMENT_ROOT'].'/tzfiles/users/'.$_SESSION['user'];
$files = scandir($dir, 1);
foreach($files as $file){
if(is_dir($file) && $file != '.' && $file != '..'){
echo '<strong class="bigger">'.$file.'</strong>';
}
}
?>[/code]

The first line of both pieces code is where the only differences are.
Link to comment
https://forums.phpfreaks.com/topic/32417-scandir/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.