在文件夹php中获取元素图像

时间:2015-03-23 11:37:42

标签: php

while($row = mysql_fetch_array($rs))
{
    $first = true;
    $fldr = $row["fldr"];
    $ttle = $row["title"];
    $directory = "admin/uploads/$fldr/";
    $images = glob($directory . "*.JPG");
    $im="";
    $html="<div class='col-md-3 gallry'><ul class='gallery clearfix'>";
    foreach($images as $image)
    {
        if ( $first ){
            $first = false;
            $html .= "<li><a href='admin/uploads/$fldr/$image' rel='prettyPhoto[gallery1]' title=''><img src='admin/uploads/$fldr/$image' class='img-responsive' alt='' /></a></li>";
        }
        else
        {
            $html .= "<li><a href='admin/uploads/$fldr/$image' rel='prettyPhoto[gallery1]' title='' style='display:none;'></a></li>";
        }

        $im =  $image;
    }
    $html .= "</ul><h6>$im</h6></div>";
}

图片无法加载。我需要访问images目录并将其加载到li标签。如果有人知道如何帮助我..

0 个答案:

没有答案