Bazı HTML çıktısı üretmek için aşağıdaki PHP kullanarak Im:
<?php
$url = "images.xml";
$xmlstr = file_get_contents($url);
$xml = new SimpleXMLElement($xmlstr);
$images = array();
$ids = array();
foreach ($xml->image as $image) {
$images[]['id'] = $image -> id;
$images[]['link'] = $image->href;
$images[]['src'] = $image->source;
$images[]['title'] = $image->title;
$images[]['alt'] = $image->alt;
$ids[] = $image -> id;
}
array_multisort($ids, SORT_ASC, $images);
foreach ($images as $image){
echo "<a href='".$image['link']."'><img src='".$image['src']."' alt='".$image['alt']."' title='".$image['title']."' /></a>";
}
?>
Ben burada kodunu değiştirmek durumunda:
foreach ($images as $image){
echo $image['link'];
echo "Item";
}
Ben görüntü bağlantıyı XML 3 kayıtlar vardır, çünkü doğru 3 kez, olsun. Ama metin Madde 12 kopyalarını almak.
Bu neden oluyor?