Ich bin ein totaler Anfänger PHP und brauchen Haben Sie etwas Hilfe :-)Wie zu verschachtelten Arrays xml zu php?
dieses xml:
Und diese Scrypt:
<?php
// Retrieve XML File
$file = file_get_contents('livescore-feed.xml');
// Parse XML with SimpleXML
$livescore_data = new SimpleXMLElement($file);
foreach ($livescore_data->league as $league) {
echo "<table class='table table-striped table-bordered table-condensed'>";
echo "<thead><tr><th colspan='6' id='league'>" . $league->attributes()->name . "</th></tr></thead>";
echo "<tbody>";
foreach ($league->match as $match) {
$status = $match->attributes()->status;
$home = $match->home->attributes()->name;
$away = $match->away->attributes()->name;
$score = $match->home->attributes()->goals . " - " . $match->away->attributes()->goals;
// If match not yet started, there will be a ":" in 'status' attribute
if (strpos($match->attributes()->status,':') !== false) {
$score = "-";
}
echo "<tr><td class='status' id='match'>" . $status . "</td><td id='match' colspan='2'>" .
$home . "</td><td class='score' id='match'>" . $score . "</td><td id='match' colspan='2'>" .
$away . "</td>
</tr>";
}
echo "</tbody></table>";
}
>
Wie um "Ereignisse" auch anzuzeigen/zu analysieren
Vielen Dank für Ihre Hilfe und Vorschläge