画像のURLの配列を作成します。
$matches = array();
preg_match_all('#(http://[^\s]*?\.jpg)#i',$html, $matches);
$matches2 = array_unique($matches); // get unique
echo "there are ".count($matches2)." items!";
print_r($matches);
カウントは、結果が1つあることを示していますが、結果は次のようになります。
there are 1 items!
Array ( [0] =>
Array (
[0] => http://testmenow.com/248472104410838590_J3o6Jq50_b.jpg
[1] => http://testmenow.com/cirrow_1338328950.jpg
[2] => http://testmenow.com/madi0601-87.jpg
[3] => http://testmenow.com/swaggirll-4.jpg
[4] => http://testmenow.com/erythie-35.jpg ))
その後、URLから各画像を印刷しようとすると、これを使用すると配列の最初の画像のみが取得されます。
foreach ($matches2 as $image) {
echo '<img src='.$image[0].' width=200 height=200>';
}
各配列アイテムを個別に印刷できるようにする必要があります-どこかで混乱していると思いますが、2時間後...まだ同じ場所にあります