2011-01-21 90 views
0

我有這樣的代碼php數組。不能得到我想要的輸出。幫我

$dir = "img/ori/"; 
$dir_thumbs = "img/thumbs/"; 

$images = array(); 
$d = dir($dir); 
while($name = $d->read()){ 
    $thumb = "thumb_".$name; 
    $images[] = array('name' => $name,'thumb_url' => $dir_thumbs.$thumb); 
} 
$d->close(); 
$o = array('images'=>$images); 

我想輸出$名稱和所有圖像thumb_url $。怎麼做。? !幫我

+6

(小題外話注:*的preg_match('/ \(JPG | GIF | PNG)*是不足夠的安全性如果這是一個上傳腳本) – Eray 2011-01-21 21:58:20

+0

什麼是你想要的輸出準確嗎? – 2011-01-21 22:00:18

+0

@Eray有趣。請你詳細說一下嗎? – Dogbert 2011-01-21 22:13:14

回答

3
<?php 
foreach ($images as $image) { 
    echo "{$image['name']} {$image['thumb_url']}"; 
} 
?> 
相關問題