Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> parser plikow, cos w rodzaju ini
ukasz20
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 28.06.2007

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


witam

napisalem maly parser ktory wczytuje go do tablicy.
plik ktory parsuje wyglada tak:

/system/logging action=memory disabled=false topics=error
/system/logging action=echo disabled=false topics=critical
/system/ntp/client enabled=true mode=unicast mode=unicast primary-ntp=87.99.32.29 secondary-ntp=217.17.34.82
/snmp/community name=ziomale address=0.0.0.0/0 read-access=true
/snmp enabled=true contact=some_compasny
#this is a sample comment
/interface/bridge/settings use-ip-firewall=true
/system/clock time-zone-name=Europe/Warsaw

obecnie robie explode po bialych znakach. /system/logging jest brane jako nazwa klucza. action=memory disabled=false topics=error sa brane jako wpisy w tablicy /system/logging disabeld => false itd.

[system/logging] => Array
(
[0] => Array
(
[action] => memory
[disabled] => false
[topics] => info,!wireless,!debug,!route,!ospf
)

[1] => Array
(
[action] => memory
[disabled] => false
[topics] => warning
)

[2] => Array
(
[action] => memory
[disabled] => false
[topics] => error
)

[3] => Array
(
[action] => echo
[disabled] => false
[topics] => critical
)

)


potrzebuje zrobic tak zeby praser lapal to co jest miedzy "" z tym ze miedzy cudzyslowiami moga znalezc sie klucze i wartosci takie same jak te ktore je definiuja np:

/system/logging action=memory disabled=false topics="error warning action=asd"

[2] => Array
(
[action] => memory
[disabled] => false
[topics] => error warning action=asd
)

Ten post edytował ukasz20 28.03.2011, 16:23:19
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 21.08.2025 - 16:07