Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Rozbicie ciągu na poszczególne komurki tabeli
Kiui
post 30.01.2013, 14:40:40
Post #1





Grupa: Zarejestrowani
Postów: 126
Pomógł: 0
Dołączył: 8.06.2012
Skąd: Lublin

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


witam.

Mam tego typu problem dostaje z zewnetrznego systemu taki ciag danych
  1. a:1:{s:8:"OpenPayU";a:2:{s:14:"HeaderResponse";a:3:{s:10:"SenderName";s:8:"checkout";s:7:"Version";s:3:"1.1";s:9:"Algorithm";s:3:"MD5";}s:19:"OrderDomainResponse";a:1:{s:21:"OrderRetrieveResponse";a:12:{s:5:"ResId";s:32:"bf704e38436b18c91cc2e0117a605222";s:6:"Status";a:1:{s:10:"StatusCode";s:16:"OPENPAYU_SUCCESS";}s:13:"MerchantPosId";s:5:"39671";s:9:"SessionId";s:15:"55555l112300123";s:14:"CustomerRecord";a:6:{s:10:"CustomerId";s:9:"anonymous";s:5:"Email";s:24:"example@mail.address.com";s:5:"Phone";s:8:"01234567";s:9:"FirstName";s:3:"Jan";s:8:"LastName";s:8:"Kowalski";s:8:"Language";s:2:"pl";}s:8:"Shipping";a:1:{s:7:"Address";a:7:{s:6:"Street";s:11:"Marcelinska";s:11:"HouseNumber";s:2:"90";s:10:"PostalCode";s:6:"69-456";s:4:"City";s:6:"Poznan";s:11:"CountryCode";s:2:"PL";s:11:"AddressType";s:8:"SHIPPING";s:13:"RecipientName";s:12:"Jan Kowalski";}}s:7:"Invoice";a:2:{s:7:"Billing";a:8:{s:6:"Street";s:11:"Marcelinska";s:11:"HouseNumber";s:2:"90";s:10:"PostalCode";s:6:"60-324";s:4:"City";s:6:"Poznan";s:11:"CountryCode";s:2:"PL";s:11:"AddressType";s:7:"BILLING";s:3:"TIN";s:13:"779-23-08-495";s:13:"RecipientName";s:7:"PayU SA";}s:17:"EInvoiceRequested";s:5:"FALSE";}s:11:"OrderStatus";s:21:"ORDER_STATUS_COMPLETE";s:13:"PaymentStatus";s:18:"PAYMENT_STATUS_END";s:10:"PaidAmount";s:4:"1205";s:12:"CurrencyCode";s:3:"PLN";s:7:"PayType";s:1:"t";}}}}
  2.  
  3.  



Potrzebuje z tego dużego ciagu wyjąć daną pogrubioną. Nie stety nie jest to takie proste ponieważ tam gdzie mamy zaznaczone kursywą s:15 ono za każdym razem przybiera inny numer

Ten post edytował Kiui 30.01.2013, 14:41:45
Go to the top of the page
+Quote Post
nospor
post 30.01.2013, 14:47:07
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Przecież to jest zserializowana tablica....

  1. $zm = 'a:1:{s:8:"OpenPayU";a:2:{s:14:"HeaderResponse";a:3:{s:10:"SenderName";s:8:"checkout";s:7:"Version";s:3:"1.1";s:9:"Algorithm";s:3:"MD5";}s:19:"OrderDomainResponse";a:1:{s:21:"OrderRetrieveResponse";a:12:{s:5:"ResId";s:32:"bf704e38436b18c91cc2e0117a605222";s:6:"Status";a:1:{s:10:"StatusCode";s:16:"OPENPAYU_SUCCESS";}s:13:"MerchantPosId";s:5:"39671";s:9:"SessionId";s:15:"55555l112300123";s:14:"CustomerRecord";a:6:{s:10:"CustomerId";s:9:"anonymous";s:5:"Email";s:24:"example@mail.address.com";s:5:"Phone";s:8:"01234567";s:9:"FirstName";s:3:"Jan";s:8:"LastName";s:8:"Kowalski";s:8:"Language";s:2:"pl";}s:8:"Shipping";a:1:{s:7:"Address";a:7:{s:6:"Street";s:11:"Marcelinska";s:11:"HouseNumber";s:2:"90";s:10:"PostalCode";s:6:"69-456";s:4:"City";s:6:"Poznan";s:11:"CountryCode";s:2:"PL";s:11:"AddressType";s:8:"SHIPPING";s:13:"RecipientName";s:12:"Jan Kowalski";}}s:7:"Invoice";a:2:{s:7:"Billing";a:8:{s:6:"Street";s:11:"Marcelinska";s:11:"HouseNumber";s:2:"90";s:10:"PostalCode";s:6:"60-324";s:4:"City";s:6:"Poznan";s:11:"CountryCode";s:2:"PL";s:11:"AddressType";s:7:"BILLING";s:3:"TIN";s:13:"779-23-08-495";s:13:"RecipientName";s:7:"PayU SA";}s:17:"EInvoiceRequested";s:5:"FALSE";}s:11:"OrderStatus";s:21:"ORDER_STATUS_COMPLETE";s:13:"PaymentStatus";s:18:"PAYMENT_STATUS_END";s:10:"PaidAmount";s:4:"1205";s:12:"CurrencyCode";s:3:"PLN";s:7:"PayType";s:1:"t";}}}}';
  2. $ar = unserialize($zm);
  3.  
  4. //teraz w $ar masz tablicę
  5. print_r($ar);

I sobie teraz wyciągaj co ci się zywnie podoba bez żadnego problemu


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
Kiui
post 30.01.2013, 15:05:10
Post #3





Grupa: Zarejestrowani
Postów: 126
Pomógł: 0
Dołączył: 8.06.2012
Skąd: Lublin

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


Robię tak:
  1. print_r($ar["SessionId"]);


Ten post edytował Kiui 30.01.2013, 15:05:32
Go to the top of the page
+Quote Post
nospor
post 30.01.2013, 15:07:08
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




No ale SessionId to kolejny podwymiar w tablicy.... zeby do niego dojsc musisz przejść przez wszystkich jego rodziców.... to wszystko jest opisane.... podane na przykłądach.... czemu macie taką awersję do manuaala?

http://pl1.php.net/manual/pl/language.types.array.php


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
Kiui
post 30.01.2013, 15:12:34
Post #5





Grupa: Zarejestrowani
Postów: 126
Pomógł: 0
Dołączył: 8.06.2012
Skąd: Lublin

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


Czy mógłbyś mi to napisać bo chyba nie rozumiem jak rozbić ten ciag na te pare tablic. Nie widzę ich poprostu
Go to the top of the page
+Quote Post
nospor
post 30.01.2013, 15:17:58
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Przyklad z manuala do ktorego podalem ci linka:
  1. <?php
  2. $array = array(
  3. "foo" => "bar",
  4. 42 => 24,
  5. "multi" => array(
  6. "dimensional" => array(
  7. "array" => "foo"
  8. )
  9. )
  10. );
  11.  
  12. var_dump($array["multi"]["dimensional"]["array"]);
  13. ?>

Patrzac po czasie w jakim odpisujesz odnosze wrazenie ze liczysz na gotowca.


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
Kiui
post 30.01.2013, 15:35:34
Post #7





Grupa: Zarejestrowani
Postów: 126
Pomógł: 0
Dołączył: 8.06.2012
Skąd: Lublin

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


  1. Array ( [OpenPayU] => Array
  2. ( [HeaderResponse] => Array
  3. ( [SenderName] => checkout [Version] => 1.1 [Algorithm] => MD5 )
  4. [OrderDomainResponse] => Array (
  5. [OrderRetrieveResponse] => Array ( [ResId] => bf704e38436b18c91cc2e0117a605222
  6. [Status] => Array ( [StatusCode] => OPENPAYU_SUCCESS ) [MerchantPosId] => 39671 [SessionId] => 55555l112300123
  7. [CustomerRecord] => Array ( [CustomerId] => anonymous [Email] => example@mail.address.com [Phone] => 01234567 [FirstName] => Jan [LastName] => Kowalski [Language] => pl )
  8. [Shipping] => Array ( [Address] => Array ( [Street] => Marcelinska [HouseNumber] => 90 [PostalCode] => 69-456 [City] => Poznan [CountryCode] => PL [AddressType] => SHIPPING [RecipientName] => Jan Kowalski ) )
  9. [Invoice] => Array ( [Billing] => Array ( [Street] => Marcelinska [HouseNumber] => 90 [PostalCode] => 60-324 [City] => Poznan [CountryCode] => PL [AddressType] => BILLING [TIN] => 779-23-08-495 [RecipientName] => PayU SA ) [EInvoiceRequested] => FALSE ) [OrderStatus] => ORDER_STATUS_COMPLETE [PaymentStatus] => PAYMENT_STATUS_END [PaidAmount] => 1205 [CurrencyCode] => PLN [PayType] => t ) ) ) )
  10.  



  1. $zm = 'a:1:{s:8:"OpenPayU";a:2:{s:14:"HeaderResponse";a:3:{s:10:"SenderName";s:8:"checkout";s:7:"Version";s:3:"1.1";s:9:"Algorithm";s:3:"MD5";}s:19:"OrderDomainResponse";a:1:{s:21:"OrderRetrieveResponse";a:12:{s:5:"ResId";s:32:"bf704e38436b18c91cc2e0117a605222";s:6:"Status";a:1:{s:10:"StatusCode";s:16:"OPENPAYU_SUCCESS";}s:13:"MerchantPosId";s:5:"39671";s:9:"SessionId";s:15:"55555l112300123";s:14:"CustomerRecord";a:6:{s:10:"CustomerId";s:9:"anonymous";s:5:"Email";s:24:"example@mail.address.com";s:5:"Phone";s:8:"01234567";s:9:"FirstName";s:3:"Jan";s:8:"LastName";s:8:"Kowalski";s:8:"Language";s:2:"pl";}s:8:"Shipping";a:1:{s:7:"Address";a:7:{s:6:"Street";s:11:"Marcelinska";s:11:"HouseNumber";s:2:"90";s:10:"PostalCode";s:6:"69-456";s:4:"City";s:6:"Poznan";s:11:"CountryCode";s:2:"PL";s:11:"AddressType";s:8:"SHIPPING";s:13:"RecipientName";s:12:"Jan Kowalski";}}s:7:"Invoice";a:2:{s:7:"Billing";a:8:{s:6:"Street";s:11:"Marcelinska";s:11:"HouseNumber";s:2:"90";s:10:"PostalCode";s:6:"60-324";s:4:"City";s:6:"Poznan";s:11:"CountryCode";s:2:"PL";s:11:"AddressType";s:7:"BILLING";s:3:"TIN";s:13:"779-23-08-495";s:13:"RecipientName";s:7:"PayU SA";}s:17:"EInvoiceRequested";s:5:"FALSE";}s:11:"OrderStatus";s:21:"ORDER_STATUS_COMPLETE";s:13:"PaymentStatus";s:18:"PAYMENT_STATUS_END";s:10:"PaidAmount";s:4:"1205";s:12:"CurrencyCode";s:3:"PLN";s:7:"PayType";s:1:"t";}}}}';
  2. $ar = unserialize($zm);
  3.  
  4. //teraz w $ar masz tablicę
  5. print_r($ar);
  6.  
  7. var_dump($ar["OpenPayU"]["HeaderResponse"]["OrderDomainResponse"]["OrderRetrieveResponse"]["Status"]["SessionId"]);
  8.  

odpowiedź null sprawdzisz co źle zrobiłem?? chociaż jestem pewien ze jest dobrze
Go to the top of the page
+Quote Post
nospor
post 30.01.2013, 15:43:21
Post #8





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




Nie wiem jak ty patrzysz na tę tablicę.... naprawdę nie widzisz jej? Przecież HeaderResponse oraz Status nie ma na ścieżce do SessionId

var_dump($ar["OpenPayU"]["OrderDomainResponse"]["OrderRetrieveResponse"]["SessionId"]);


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

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 Wersja Lo-Fi Aktualny czas: 12.06.2025 - 20:59