Afficher un message
Vieux 23/10/2007, 16h19   #2
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to get the files names from the folder using PHP ..


"anu" <anunanni2006@gmail.com> wrote in message
news:1193129945.656683.280660@k35g2000prh.googlegr oups.com...
>
> Hi,
>
> How to get the files names from the folder using PHP .. is there any
> specific command.
> if yes let me know that..


see if this s:

function listFiles($path = '.', $extension = array(), $combine = false)
{
$wd = getcwd();
$path .= substr($path, -1) != '/' ? '/' : '';
if (!chdir($path)){ return array(); }
if (!$extension){ $extension = array('*'); }
if (!is_array($extension)){ $extension = array($extension); }
$extensions = '*.{' . implode(',', $extension) . '}';
$files = glob($extensions, GLOB_BRACE);
chdir($wd);
if (!$files){ return array(); }
$list = array();
foreach ($files as $file)
{
$list[] = ($combine ? $path : '') . $file;
}
return $list;
}


  Réponse avec citation
 
Page generated in 0,04577 seconds with 9 queries