Coucou,
voici mon code pour afficher le contenu de fichiers .xml , malheureusement mon script provoque un out of memory, et je ne vois pas d'ou ça vient, pouvez-vous m'aider?
++
Modifié par csseur666 (11 Aug 2009 - 14:56)
voici mon code pour afficher le contenu de fichiers .xml , malheureusement mon script provoque un out of memory, et je ne vois pas d'ou ça vient, pouvez-vous m'aider?
$chemin = '/home/toto/files/';
$dossier = opendir( $chemin );
$exceptions = array( '.', '..' );
while ( $fichier = readdir( $dossier ) )
{
if ( !in_array( $fichier, $exceptions ) AND preg_match( '`.xml$`', $fichier ) == 1 )
{
if ( FALSE !== $informations = @simplexml_load_file($chemin.$fichier));
foreach ($informations->localisation as $item) {
if (isset($item->pays) && strlen($item->pays)) {
echo '<tr><td>'.$item->pays.'</td>';
} else {
echo '<tr><td>vide</td>';
}
if (isset($item->departement) && strlen($item->departement)) {
echo '<td>'.$item->departement.'</td>';
} else {
echo '<td>vide</td>';
}
}
foreach ($informations->presentation as $item) {
if (isset($item->nom) && strlen($item->nom)) {
echo '<td>'.$item->nom.'</td>';
} else {
echo '<td>vide</td>';
}
}
foreach ($informations->annonces as $item) {
if (isset($item->demande) && strlen($item->demande)) {
echo '<td>'.$item->demande.'</td>';
} else {
echo '<td>vide</td>';
}
if (isset($item->offre) && strlen($item->offre)) {
echo '<td>'.$item->offre.'</td>';
} else {
echo '<td>vide</td>';
}
}
foreach ($informations->fichier as $item) {
if (isset($item->modification) && strlen($item->modification)) {
echo '<td style="font-size: 14px; font-weight: bold; color: #F60000;">'.$item->modification.'</td></tr>';
} else {
echo '<td style="font-size: 14px;">vide</td></tr>';
}
}
}
}
++
Modifié par csseur666 (11 Aug 2009 - 14:56)