![]() |
![]() |
![]()
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 ) ) ) |
|
|
![]() ![]() |
![]() |
Aktualny czas: 3.10.2025 - 16:27 |