Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> xml dodawanie atrybutu
MatXpl
post
Post #1





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 1.06.2010

Ostrzeżenie: (0%)
-----


  1. $xml = simplexml_load_file("aaa.xml");
  2. foreach ($xml as $x);
  3. {
  4. $x->$child= addChild("aaa");
  5. foreach ($xml->body->children() as $child);
  6. {
  7. $xml->$child->addAttribute("name",name);
  8. $xml->$child->addAttribute("id",id);
  9. $xml->$child->addAttribute("data",data);
  10. }
  11. }


jak to zrobić?

Ten post edytował MatXpl 3.03.2013, 11:11:33
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
sazian
post
Post #2





Grupa: Zarejestrowani
Postów: 1 045
Pomógł: 141
Dołączył: 19.09.2006
Skąd: B-tów

Ostrzeżenie: (0%)
-----


jak co zrobić ?
i co to za potworki
$x->$child
co to $child ?

$xml->$child->addAttribute("name",name);
dlaczego $xml->$child i co niby miałby by zrobić
i gdzie definiujesz stałą name ?
Go to the top of the page
+Quote Post
MatXpl
post
Post #3





Grupa: Zarejestrowani
Postów: 23
Pomógł: 0
Dołączył: 1.06.2010

Ostrzeżenie: (0%)
-----


name itp mam zdefiniowane chodzi o to żeby otworzyć plik, stworzyć w nim child i dodać do niego atrybuty
Go to the top of the page
+Quote Post
_Borys_
post
Post #4





Grupa: Zarejestrowani
Postów: 587
Pomógł: 190
Dołączył: 5.02.2011
Skąd: 64-800

Ostrzeżenie: (0%)
-----


Po co te pętle
Parsing XML in PHP Using SimpleXML
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 17.09.2025 - 23:35