0

サーバーからの画像名を表示(PHPエコー)すると、次のように表示されます。

リソースID#32global_2012062513406170744fe83172d6c99.jpgリソースID#33330394727_2012062613406707734fe90335d0a5e.jpg

画像名に関連付けられている「リソースID#32」を削除するにはどうすればよいですか?それなら私だけがサーバーからの画像を表示できますか?または、画像を表示する他の方法はありますか?コードは

 69 if(is_dir($dir))
 70         {               
 71         $dir = opendir($dir);   
 72                 while (false !== ($file = readdir($dir)))
 73                 {       
 74                         if ($file != "." && $file != "..")
 75                         {
 76                                 $files[] = $file;
 77                         }
 78                 }
 79         closedir($dir);
 80         }
 81 //srand ((double) microtime( )*1000000);
 82 $randnum = mt_rand(0,(sizeof($files)-1));
 83 $img = $dir.$files[$randnum];
 84 echo $img;

ありがとう!

4

1 に答える 1

0
if(is_dir($dir))
{               
    $openDir = opendir($dir);   
    while (false !== ($file = readdir($openDir)))
    {       
        if ($file != "." && $file != "..")
        {
            $files[] = $file;
        }
    }
    closedir($openDir);
}
//srand ((double) microtime( )*1000000);
$randnum = mt_rand(0,(sizeof($files)-1));
$img = $dir.$files[$randnum];
echo $img;

これを使って。

于 2012-06-27T05:50:40.403 に答える