|
|
|
| Зарасти всем,
Не могу разобраться с задачей.
Надо поместить в массив рисунки из папки images, подсчитать их количество и вывести на экран.
С выводом, вроде разобралась:
if ($handle = opendir('images')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo $file;
echo "<br />";
}
}
closedir($handle);
}
|
Подсчитать тоже не проблема, а вот засунуть их в массив не получается. HELP...
Спасибо | |
|
|
|
|
|
|
|
для: sasch
(25.11.2006 в 12:26)
| | Надо поместить в массив рисунки из папки images
Ссылки на эти рисунки нужны?
<?php
$images = array();
if ($handle = opendir("images"))
{
while(($file = readdir($handle) !== false)
{
if($file == "." || $file == ".." || $file = ".htaccess") continue;
$images[] = realpath("images/".$file);
}
}
?>
|
| |
|
|
|
|
|
|
|
для: Unkind
(25.11.2006 в 13:03)
| | да | |
|
|
|
|
|
|
|
для: sasch
(25.11.2006 в 13:09)
| |
<?php
define("DIR", dirname($_SERVER['PHP_SELF'])."/images/");
$images = array();
if ($handle = opendir("images"))
{
while(($file = readdir($handle) !== false)
{
if($file == "." || $file == ".." || $file = ".htaccess") continue;
$images[] = "<a href='".DIR.$file."'>Рисунок ".$file."</a><br />\n";
}
closedir($handle);
}
?>
|
| |
|
|
|