Post
#1
|
|
|
Grupa: Przyjaciele php.pl Postów: 742 Pomógł: 0 Dołączył: 14.12.2003 Skąd: Gdańsk, Trójmiasto Ostrzeżenie: (0%)
|
witam,
Na php.net znalazłem funkcję która konwertuje obiekt simplexml do tablicy: Niestety dla takiego xmlu: wychodzi zly kod, bo z obiektem: Cytat Array Nie wiem jak to naprawić, bo zamiast obiektu powinna byc kolejna tablica (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) Może mi ktoś pomóc?
( [action] => Array ( [0] => SimpleXMLElement Object ( [default] => true [name] => main [requiredRoles] => viewNews [type] => view [matches] => main [fallback] => accessDenied ) [1] => SimpleXMLElement Object ( [name] => footer [requiredRoles] => viewNews [type] => view [matches] => null [fallback] => accessDenied ) ) ) Ten post edytował olo 13.01.2005, 18:03:26 |
|
|
|
![]() |
Post
#2
|
|
|
Grupa: Przyjaciele php.pl Postów: 742 Pomógł: 0 Dołączył: 14.12.2003 Skąd: Gdańsk, Trójmiasto Ostrzeżenie: (0%)
|
witam,
doszedłem już czemu to nie działa. Napisałem własny konwerter obj=>arr:
teraz dwa listtingi: pierwszy to var_dump obiektu simplexml, drugi to wynik działania funkcji na tym obiekcie: Cytat object(SimpleXMLElement)#1 (1) { ["action"]=> array(2) { [0]=> object(SimpleXMLElement)#4 (6) { ["default"]=> string(4) "true" ["name"]=> string(4) "main" ["requiredRoles"]=> string(8) "viewNews" ["type"]=> string(4) "view" ["matches"]=> string(4) "main" ["fallback"]=> string(12) "accessDenied" } [1]=> object(SimpleXMLElement)#5 (5) { ["name"]=> string(6) "footer" ["requiredRoles"]=> string(8) "viewNews" ["type"]=> string(4) "view" ["matches"]=> string(4) "null" ["fallback"]=> string(12) "accessDenied" } } } Cytat Array Podczas pierwszej rekurencji funkcja widzi TYLKO tablice, więc nie wchodzi do tej tabicy, dlatego w srodku pozostają obiekty. Zakomentowałem sposób w jaki chciałem to ominąc, niestety on nie działa. TerazCzy ktoś wie jak to naprawić (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
( [action] => Array ( [0] => SimpleXMLElement Object ( [default] => true [name] => main [requiredRoles] => viewNews [type] => view [matches] => main [fallback] => accessDenied ) [1] => SimpleXMLElement Object ( [name] => footer [requiredRoles] => viewNews [type] => view [matches] => null [fallback] => accessDenied ) ) ) |
|
|
|
aleksander [simpleXML] funkcja obj2array zle dziala 13.01.2005, 17:44:50
hwao Tzn ze klucza nie ma na poczatku actions? to da si... 13.01.2005, 18:00:22
cobyl hm, problem ten też mnie nurtował, wymyśliłem coś ... 4.02.2005, 06:50:05
Vengeance cholera nie ma porzadnej funkcji tego typu.
potrze... 6.02.2005, 21:09:10
aleksander na forum algorytmy/klasy/funkcje mam dwie funkcje ... 7.02.2005, 15:02:15
Vengeance Hmm watpie... ale przerobilem jedna z funkcji na p... 7.02.2005, 18:27:46 ![]() ![]() |
|
Aktualny czas: 27.12.2025 - 13:54 |