Bonjour j'ai un fichier xml de type :
je souhaiterais avec un formulaire php ajouter une ligne pic avec src,label et data.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 <backstage> <pic src="img/beauty/thumbnails/beauty-1.jpg" label="Milana Keller" data="img/beauty/beauty-1.jpg"/> <pic src="img/beauty/thumbnails/beauty-2.jpg" label="Milana Keller" data="img/beauty/beauty-2.jpg" </backstage>
voici mon code php :
mon code a l'air bon mais ne marche pas, c'est surement une petite erreur a la con sauf que j'y ai passé la matinée
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 $filename = $chemin_destination.'listing.xml'; $newContent = "\r\t<pic src=\"".$src."\" label=\"".$label."\" data=\"".$data."\"/>"; $newContent .= "\r</pic>"; $content = file_get_contents($filename); $newContent = str_replace('</pic>', $newContent, $content); $handle = fopen($filename, 'w'); fwrite($handle, $newContent); fclose($handle);
si quelqu'un peux m'aider ce serais très gentil de sa part merci d'avance
Partager