2017-05-17 1 views
0

Ich habe einige Zimmerpreise in der wp_options Tabelle aus meiner Datenbank gespeichert.Extrahieren mit PHP aus Wordpress-Optionen

option_value hat so etwas wie:

"seasonal_prices_schema"; 
a:37:{i:1; 
a:3:{s:4:"from";s:10:"2017-05-11";s:2:"to";s:10:"2017-05-12";s:5:"index";s:1:"1";}i:2; 
a:3:{s:4:"from";s:10:"2017-05-13";s:2:"to";s:10:"2017-05-14";s:5:"index";s:1:"2";}} 

Wie kann ich sie mit einfachen PHP zu extrahieren, nicht in Wordpress?

EDIT:

$mydata = 'a:5:{s:9:"engine_id";a:1:{i:0;s:9:"300000225";}s:15:"transmission_id";a:1:{i:0;s:6:"257691";}s:5:"plant";a:1:{i:0;s:23:"Oshawa, Ontario, Canada";}s:15:"Manufactured in";a:1:{i:0;s:6:"CANADA";}s:22:"Production Seq. Number";a:1:{i:0;s:6:"151411";}}'; 
$mydata = unserialize($mydata); 
echo $mydata['Manufactured in'][0]; 

und Druck CANADA

Aber ich kann es nicht mit meinen realen Daten bekommen.

$mydata = 'a:83:{i:0;s:0:"";s:10:"hotel_name";s:10:"1";s:13:"hotel_address";s:39:"1";s:14:"hotel_locality";s:22:"1";s:15:"hotel_telephone";s:12:"1";s:11:"hotel_email";s:19:"1";s:13:"hotel_checkin";a:2:{s:4:"from";s:2:"15";s:2:"to";s:2:"16";}s:14:"hotel_checkout";a:2:{s:4:"from";s:2:"11";s:2:"to";s:2:"12";}s:18:"hotel_pets_message";s:16:"Pets are allowed";s:12:"listing_page";s:2:"12";s:12:"booking_page";s:2:"13";s:20:"reservation_received";s:20:"reservation-received";s:12:"pay_endpoint";s:15:"pay-reservation";s:8:"currency";s:3:"IDR";s:17:"currency_position";s:5:"after";s:19:"thousands_separator";s:1:",";s:17:"decimal_separator";s:1:".";s:14:"room_size_unit";s:3:"m²";s:15:"listing_sorting";s:5:"title";s:18:"low_room_threshold";i:1;s:23:"room_catalog_image_size";a:3:{s:5:"width";i:480;s:6:"height";i:294;s:4:"crop";i:1;}s:22:"room_single_image_size";a:3:{s:5:"width";i:1140;s:6:"height";i:699;s:4:"crop";i:1;}s:25:"room_thumbnail_image_size";a:3:{s:5:"width";i:85;s:6:"height";i:85;s:4:"crop";i:1;}s:13:"room_lightbox";s:1:"1";s:12:"booking_mode";s:14:"manual-booking";s:30:"booking_additional_information";s:1:"1";s:22:"booking_minimum_nights";i:1;s:20:"booking_hold_minutes";i:120;s:35:"hide_disabled_dates_from_datepicker";s:1:"1";s:34:"allow_checkout_first_disabled_date";s:1:"1";s:16:"payment_gateways";a:1:{s:6:"paypal";s:1:"1";}s:15:"default_gateway";s:6:"paypal";s:14:"paypal_message";s:54:"Pay with PayPal - The safer, easier way to pay online!";s:14:"stripe_message";s:45:"Pay with your credit or debit card via Stripe";s:19:"emails_admin_notice";s:19:"1";s:16:"emails_from_name";s:10:"Casa Coral";s:25:"emails_from_email_address";s:19:"1";s:11:"emails_type";s:4:"html";s:11:"emails_logo";s:55:"1";s:18:"emails_footer_text";s:58:"1";s:30:"emails_new_reservation_enabled";s:1:"1";s:30:"emails_new_reservation_subject";s:51:"{site_title} - Rezervare noua #{reservation_number}";s:30:"emails_new_reservation_heading";s:14:"Rezervare noua";s:31:"emails_request_received_enabled";s:1:"1";s:31:"emails_request_received_subject";s:35:"Rezervarea dvs. pentru {site_title}";s:31:"emails_request_received_heading";s:14:"Cerere primita";s:36:"emails_confirmed_reservation_enabled";s:1:"1";s:36:"emails_confirmed_reservation_subject";s:35:"Rezervarea dvs. pentru {site_title}";s:36:"emails_confirmed_reservation_heading";s:29:"Va multumim pentru rezervare!";s:28:"emails_guest_invoice_subject";s:46:"Factura pentru rezervare #{reservation_number}";s:28:"emails_guest_invoice_heading";s:46:"Factura pentru rezervare #{reservation_number}";s:36:"emails_cancelled_reservation_enabled";s:1:"1";s:36:"emails_cancelled_reservation_subject";s:54:"{site_title} - Rezervare anulata #{reservation_number}";s:36:"emails_cancelled_reservation_heading";s:17:"Rezervare anulata";s:42:"emails_guest_cancelled_reservation_enabled";s:1:"1";s:42:"emails_guest_cancelled_reservation_subject";s:35:"Rezervarea dvs. pentru {site_title}";s:42:"emails_guest_cancelled_reservation_heading";s:17:"Rezervare anulata";s:22:"seasonal_prices_schema";a:37:{i:1;a:3:{s:4:"from";s:10:"2017-05-11";s:2:"to";s:10:"2017-05-12";s:5:"index";s:1:"1";}i:2;a:3:{s:4:"from";s:10:"2017-05-13";s:2:"to";s:10:"2017-05-14";s:5:"index";s:1:"2";}i:3;a:3:{s:4:"from";s:10:"2017-05-15";s:2:"to";s:10:"2017-05-19";s:5:"index";s:1:"3";}i:4;a:3:{s:4:"from";s:10:"2017-05-20";s:2:"to";s:10:"2017-05-21";s:5:"index";s:1:"4";}i:5;a:3:{s:4:"from";s:10:"2017-05-22";s:2:"to";s:10:"2017-05-26";s:5:"index";s:1:"5";}i:6;a:3:{s:4:"from";s:10:"2017-05-27";s:2:"to";s:10:"2017-05-28";s:5:"index";s:1:"6";}i:7;a:3:{s:4:"from";s:10:"2017-05-29";s:2:"to";s:10:"2017-06-02";s:5:"index";s:1:"7";}i:8;a:3:{s:4:"from";s:10:"2017-06-03";s:2:"to";s:10:"2017-06-04";s:5:"index";s:1:"8";}i:9;a:3:{s:4:"from";s:10:"2017-06-05";s:2:"to";s:10:"2017-06-09";s:5:"index";s:1:"9";}i:10;a:3:{s:4:"from";s:10:"2017-06-10";s:2:"to";s:10:"2017-06-11";s:5:"index";s:2:"10";}i:11;a:3:{s:4:"from";s:10:"2017-06-12";s:2:"to";s:10:"2017-06-16";s:5:"index";s:2:"11";}i:12;a:3:{s:4:"from";s:10:"2017-06-17";s:2:"to";s:10:"2017-06-18";s:5:"index";s:2:"12";}i:13;a:3:{s:4:"from";s:10:"2017-06-19";s:2:"to";s:10:"2017-06-23";s:5:"index";s:2:"13";}i:14;a:3:{s:4:"from";s:10:"2017-06-24";s:2:"to";s:10:"2017-06-25";s:5:"index";s:2:"14";}i:15;a:3:{s:4:"from";s:10:"2017-06-26";s:2:"to";s:10:"2017-06-30";s:5:"index";s:2:"15";}i:16;a:3:{s:4:"from";s:10:"2017-07-01";s:2:"to";s:10:"2017-07-02";s:5:"index";s:2:"16";}i:17;a:3:{s:4:"from";s:10:"2017-07-03";s:2:"to";s:10:"2017-07-07";s:5:"index";s:2:"17";}i:18;a:3:{s:4:"from";s:10:"2017-07-08";s:2:"to";s:10:"2017-07-09";s:5:"index";s:2:"18";}i:19;a:3:{s:4:"from";s:10:"2017-07-10";s:2:"to";s:10:"2017-07-14";s:5:"index";s:2:"19";}i:20;a:3:{s:4:"from";s:10:"2017-07-15";s:2:"to";s:10:"2017-07-16";s:5:"index";s:2:"20";}i:21;a:3:{s:4:"from";s:10:"2017-07-17";s:2:"to";s:10:"2017-07-21";s:5:"index";s:2:"21";}i:22;a:3:{s:4:"from";s:10:"2017-07-22";s:2:"to";s:10:"2017-07-23";s:5:"index";s:2:"22";}i:23;a:3:{s:4:"from";s:10:"2017-07-24";s:2:"to";s:10:"2017-07-28";s:5:"index";s:2:"23";}i:24;a:3:{s:4:"from";s:10:"2017-07-29";s:2:"to";s:10:"2017-07-30";s:5:"index";s:2:"24";}i:25;a:3:{s:4:"from";s:10:"2017-07-31";s:2:"to";s:10:"2017-08-04";s:5:"index";s:2:"25";}i:26;a:3:{s:4:"from";s:10:"2017-08-05";s:2:"to";s:10:"2017-08-06";s:5:"index";s:2:"26";}i:27;a:3:{s:4:"from";s:10:"2017-08-07";s:2:"to";s:10:"2017-08-11";s:5:"index";s:2:"27";}i:28;a:3:{s:4:"from";s:10:"2017-08-12";s:2:"to";s:10:"2017-08-13";s:5:"index";s:2:"28";}i:29;a:3:{s:4:"from";s:10:"2017-08-14";s:2:"to";s:10:"2017-08-18";s:5:"index";s:2:"29";}i:30;a:3:{s:4:"from";s:10:"2017-08-19";s:2:"to";s:10:"2017-08-20";s:5:"index";s:2:"30";}i:31;a:3:{s:4:"from";s:10:"2017-08-21";s:2:"to";s:10:"2017-08-25";s:5:"index";s:2:"31";}i:32;a:3:{s:4:"from";s:10:"2017-08-26";s:2:"to";s:10:"2017-08-27";s:5:"index";s:2:"32";}i:33;a:3:{s:4:"from";s:10:"2017-08-28";s:2:"to";s:10:"2017-09-01";s:5:"index";s:2:"33";}i:34;a:3:{s:4:"from";s:10:"2017-09-02";s:2:"to";s:10:"2017-09-03";s:5:"index";s:2:"34";}i:35;a:3:{s:4:"from";s:10:"2017-09-04";s:2:"to";s:10:"2017-09-08";s:5:"index";s:2:"35";}i:36;a:3:{s:4:"from";s:10:"2017-09-09";s:2:"to";s:10:"2017-09-10";s:5:"index";s:2:"36";}i:37;a:3:{s:4:"from";s:10:"2017-09-11";s:2:"to";s:10:"2018-02-28";s:5:"index";s:2:"37";}}s:22:"booking_months_advance";i:0;s:20:"booking_arrival_date";i:0;s:22:"booking_maximum_nights";i:0;s:21:"disabled_dates_schema";a:0:{}s:27:"room_unavailable_visibility";i:0;s:14:"paypal_sandbox";s:1:"1";s:20:"hotel_accepted_cards";a:4:{s:10:"mastercard";s:1:"1";s:4:"visa";s:1:"1";s:7:"maestro";s:1:"1";s:6:"visa_e";s:1:"1";}s:12:"paypal_email";s:0:"";s:17:"paypal_page_style";s:0:"";s:17:"stripe_form_image";s:0:"";s:22:"stripe_live_secret_key";s:0:"";s:27:"stripe_live_publishable_key";s:0:"";s:22:"stripe_test_secret_key";s:0:"";s:27:"stripe_test_publishable_key";s:0:"";s:10:"paypal_log";i:0;s:15:"stripe_testmode";i:0;s:10:"stripe_log";i:0;s:10:"terms_page";s:3:"521";s:28:"emails_guest_invoice_enabled";i:0;s:14:"hotel_postcode";s:0:"";s:9:"hotel_fax";s:0:"";s:18:"price_num_decimals";i:0;s:10:"hotel_pets";i:0;s:19:"enforce_ssl_booking";i:0;s:19:"unforce_ssl_booking";i:0;}'; 
$mydata = unserialize($mydata); 
echo $mydata['seasonal_prices_schema'][0]; 

Ich weiß, dass das Problem irgendwo hier ist echo $mydata['seasonal_prices_schema'][0]; aber ich weiß nicht, was ich als nächstes tun soll.

EDIT 2.

while($row = mysqli_fetch_array($result)){ 
    $etc = $row['option_value']; 
    $data = unserialize($etc); 
    $tabel = $data['seasonal_prices_schema']; 
    foreach($tabel as $linie) {   
     $from = $linie['from']; 
     $to = $linie['to']; 

     echo '<tr>'; 
     echo '<td>' . $from . '</td>'; 
     echo '<td>' . $to . '</td>'; 
     echo '</tr>';   
    }           
} 

Warning: Invalid argument für foreach geliefert() in etc.php on line 102

+0

Verwendung 'unserialize ($ string)' –

+0

Danke, ich die Post bearbeitet haben. –

Antwort

0

neben sahil Gulati Kommentar, Sie kann eine Sicherheitsprüfung anwenden

<?php 
    $b = 'serialize string'; 

    if(($b == serialize(false) || @unserialize($b) !== false)){ 
     var_dump(unserialize($b)); 
    } 
+0

Danke, ich werde es im Auge behalten, um den Scheck anzuwenden. –

0

Ihr Code schlägt aufgrund einer fehlerhaften serialisierten Zeichenfolge fehl (dies scheint ein "unsichtbarer" Fehler zu sein - ich vermute, dass dies ein Problem auf der Byteebene ist, die spezifisch für hotel_address ist. Wenn Sie Ihre Zeichenfolge einfügen @https://www.functions-online.com/unserialize.html wird Ihnen sagen, dass Sie einen Syntaxfehler auf Offset 51 haben.

Unabhängig von der Ursache, eine Lösung ist, eine preg_match_callback() Funktion anwenden, um die Zeichenfolge zu beheben. Dies ist where I pulled the function call.

Code: (Demo)

$rows[0]['option_value']='a:83:{i:0;s:0:"";s:10:"hotel_name";s:10:"1";s:13:"hotel_address";s:39:"1";s:14:"hotel_locality";s:22:"1";s:15:"hotel_telephone";s:12:"1";s:11:"hotel_email";s:19:"1";s:13:"hotel_checkin";a:2:{s:4:"from";s:2:"15";s:2:"to";s:2:"16";}s:14:"hotel_checkout";a:2:{s:4:"from";s:2:"11";s:2:"to";s:2:"12";}s:18:"hotel_pets_message";s:16:"Pets are allowed";s:12:"listing_page";s:2:"12";s:12:"booking_page";s:2:"13";s:20:"reservation_received";s:20:"reservation-received";s:12:"pay_endpoint";s:15:"pay-reservation";s:8:"currency";s:3:"IDR";s:17:"currency_position";s:5:"after";s:19:"thousands_separator";s:1:",";s:17:"decimal_separator";s:1:".";s:14:"room_size_unit";s:3:"m²";s:15:"listing_sorting";s:5:"title";s:18:"low_room_threshold";i:1;s:23:"room_catalog_image_size";a:3:{s:5:"width";i:480;s:6:"height";i:294;s:4:"crop";i:1;}s:22:"room_single_image_size";a:3:{s:5:"width";i:1140;s:6:"height";i:699;s:4:"crop";i:1;}s:25:"room_thumbnail_image_size";a:3:{s:5:"width";i:85;s:6:"height";i:85;s:4:"crop";i:1;}s:13:"room_lightbox";s:1:"1";s:12:"booking_mode";s:14:"manual-booking";s:30:"booking_additional_information";s:1:"1";s:22:"booking_minimum_nights";i:1;s:20:"booking_hold_minutes";i:120;s:35:"hide_disabled_dates_from_datepicker";s:1:"1";s:34:"allow_checkout_first_disabled_date";s:1:"1";s:16:"payment_gateways";a:1:{s:6:"paypal";s:1:"1";}s:15:"default_gateway";s:6:"paypal";s:14:"paypal_message";s:54:"Pay with PayPal - The safer, easier way to pay online!";s:14:"stripe_message";s:45:"Pay with your credit or debit card via Stripe";s:19:"emails_admin_notice";s:19:"1";s:16:"emails_from_name";s:10:"Casa Coral";s:25:"emails_from_email_address";s:19:"1";s:11:"emails_type";s:4:"html";s:11:"emails_logo";s:55:"1";s:18:"emails_footer_text";s:58:"1";s:30:"emails_new_reservation_enabled";s:1:"1";s:30:"emails_new_reservation_subject";s:51:"{site_title} - Rezervare noua #{reservation_number}";s:30:"emails_new_reservation_heading";s:14:"Rezervare noua";s:31:"emails_request_received_enabled";s:1:"1";s:31:"emails_request_received_subject";s:35:"Rezervarea dvs. pentru {site_title}";s:31:"emails_request_received_heading";s:14:"Cerere primita";s:36:"emails_confirmed_reservation_enabled";s:1:"1";s:36:"emails_confirmed_reservation_subject";s:35:"Rezervarea dvs. pentru {site_title}";s:36:"emails_confirmed_reservation_heading";s:29:"Va multumim pentru rezervare!";s:28:"emails_guest_invoice_subject";s:46:"Factura pentru rezervare #{reservation_number}";s:28:"emails_guest_invoice_heading";s:46:"Factura pentru rezervare #{reservation_number}";s:36:"emails_cancelled_reservation_enabled";s:1:"1";s:36:"emails_cancelled_reservation_subject";s:54:"{site_title} - Rezervare anulata #{reservation_number}";s:36:"emails_cancelled_reservation_heading";s:17:"Rezervare anulata";s:42:"emails_guest_cancelled_reservation_enabled";s:1:"1";s:42:"emails_guest_cancelled_reservation_subject";s:35:"Rezervarea dvs. pentru {site_title}";s:42:"emails_guest_cancelled_reservation_heading";s:17:"Rezervare anulata";s:22:"seasonal_prices_schema";a:37:{i:1;a:3:{s:4:"from";s:10:"2017-05-11";s:2:"to";s:10:"2017-05-12";s:5:"index";s:1:"1";}i:2;a:3:{s:4:"from";s:10:"2017-05-13";s:2:"to";s:10:"2017-05-14";s:5:"index";s:1:"2";}i:3;a:3:{s:4:"from";s:10:"2017-05-15";s:2:"to";s:10:"2017-05-19";s:5:"index";s:1:"3";}i:4;a:3:{s:4:"from";s:10:"2017-05-20";s:2:"to";s:10:"2017-05-21";s:5:"index";s:1:"4";}i:5;a:3:{s:4:"from";s:10:"2017-05-22";s:2:"to";s:10:"2017-05-26";s:5:"index";s:1:"5";}i:6;a:3:{s:4:"from";s:10:"2017-05-27";s:2:"to";s:10:"2017-05-28";s:5:"index";s:1:"6";}i:7;a:3:{s:4:"from";s:10:"2017-05-29";s:2:"to";s:10:"2017-06-02";s:5:"index";s:1:"7";}i:8;a:3:{s:4:"from";s:10:"2017-06-03";s:2:"to";s:10:"2017-06-04";s:5:"index";s:1:"8";}i:9;a:3:{s:4:"from";s:10:"2017-06-05";s:2:"to";s:10:"2017-06-09";s:5:"index";s:1:"9";}i:10;a:3:{s:4:"from";s:10:"2017-06-10";s:2:"to";s:10:"2017-06-11";s:5:"index";s:2:"10";}i:11;a:3:{s:4:"from";s:10:"2017-06-12";s:2:"to";s:10:"2017-06-16";s:5:"index";s:2:"11";}i:12;a:3:{s:4:"from";s:10:"2017-06-17";s:2:"to";s:10:"2017-06-18";s:5:"index";s:2:"12";}i:13;a:3:{s:4:"from";s:10:"2017-06-19";s:2:"to";s:10:"2017-06-23";s:5:"index";s:2:"13";}i:14;a:3:{s:4:"from";s:10:"2017-06-24";s:2:"to";s:10:"2017-06-25";s:5:"index";s:2:"14";}i:15;a:3:{s:4:"from";s:10:"2017-06-26";s:2:"to";s:10:"2017-06-30";s:5:"index";s:2:"15";}i:16;a:3:{s:4:"from";s:10:"2017-07-01";s:2:"to";s:10:"2017-07-02";s:5:"index";s:2:"16";}i:17;a:3:{s:4:"from";s:10:"2017-07-03";s:2:"to";s:10:"2017-07-07";s:5:"index";s:2:"17";}i:18;a:3:{s:4:"from";s:10:"2017-07-08";s:2:"to";s:10:"2017-07-09";s:5:"index";s:2:"18";}i:19;a:3:{s:4:"from";s:10:"2017-07-10";s:2:"to";s:10:"2017-07-14";s:5:"index";s:2:"19";}i:20;a:3:{s:4:"from";s:10:"2017-07-15";s:2:"to";s:10:"2017-07-16";s:5:"index";s:2:"20";}i:21;a:3:{s:4:"from";s:10:"2017-07-17";s:2:"to";s:10:"2017-07-21";s:5:"index";s:2:"21";}i:22;a:3:{s:4:"from";s:10:"2017-07-22";s:2:"to";s:10:"2017-07-23";s:5:"index";s:2:"22";}i:23;a:3:{s:4:"from";s:10:"2017-07-24";s:2:"to";s:10:"2017-07-28";s:5:"index";s:2:"23";}i:24;a:3:{s:4:"from";s:10:"2017-07-29";s:2:"to";s:10:"2017-07-30";s:5:"index";s:2:"24";}i:25;a:3:{s:4:"from";s:10:"2017-07-31";s:2:"to";s:10:"2017-08-04";s:5:"index";s:2:"25";}i:26;a:3:{s:4:"from";s:10:"2017-08-05";s:2:"to";s:10:"2017-08-06";s:5:"index";s:2:"26";}i:27;a:3:{s:4:"from";s:10:"2017-08-07";s:2:"to";s:10:"2017-08-11";s:5:"index";s:2:"27";}i:28;a:3:{s:4:"from";s:10:"2017-08-12";s:2:"to";s:10:"2017-08-13";s:5:"index";s:2:"28";}i:29;a:3:{s:4:"from";s:10:"2017-08-14";s:2:"to";s:10:"2017-08-18";s:5:"index";s:2:"29";}i:30;a:3:{s:4:"from";s:10:"2017-08-19";s:2:"to";s:10:"2017-08-20";s:5:"index";s:2:"30";}i:31;a:3:{s:4:"from";s:10:"2017-08-21";s:2:"to";s:10:"2017-08-25";s:5:"index";s:2:"31";}i:32;a:3:{s:4:"from";s:10:"2017-08-26";s:2:"to";s:10:"2017-08-27";s:5:"index";s:2:"32";}i:33;a:3:{s:4:"from";s:10:"2017-08-28";s:2:"to";s:10:"2017-09-01";s:5:"index";s:2:"33";}i:34;a:3:{s:4:"from";s:10:"2017-09-02";s:2:"to";s:10:"2017-09-03";s:5:"index";s:2:"34";}i:35;a:3:{s:4:"from";s:10:"2017-09-04";s:2:"to";s:10:"2017-09-08";s:5:"index";s:2:"35";}i:36;a:3:{s:4:"from";s:10:"2017-09-09";s:2:"to";s:10:"2017-09-10";s:5:"index";s:2:"36";}i:37;a:3:{s:4:"from";s:10:"2017-09-11";s:2:"to";s:10:"2018-02-28";s:5:"index";s:2:"37";}}s:22:"booking_months_advance";i:0;s:20:"booking_arrival_date";i:0;s:22:"booking_maximum_nights";i:0;s:21:"disabled_dates_schema";a:0:{}s:27:"room_unavailable_visibility";i:0;s:14:"paypal_sandbox";s:1:"1";s:20:"hotel_accepted_cards";a:4:{s:10:"mastercard";s:1:"1";s:4:"visa";s:1:"1";s:7:"maestro";s:1:"1";s:6:"visa_e";s:1:"1";}s:12:"paypal_email";s:0:"";s:17:"paypal_page_style";s:0:"";s:17:"stripe_form_image";s:0:"";s:22:"stripe_live_secret_key";s:0:"";s:27:"stripe_live_publishable_key";s:0:"";s:22:"stripe_test_secret_key";s:0:"";s:27:"stripe_test_publishable_key";s:0:"";s:10:"paypal_log";i:0;s:15:"stripe_testmode";i:0;s:10:"stripe_log";i:0;s:10:"terms_page";s:3:"521";s:28:"emails_guest_invoice_enabled";i:0;s:14:"hotel_postcode";s:0:"";s:9:"hotel_fax";s:0:"";s:18:"price_num_decimals";i:0;s:10:"hotel_pets";i:0;s:19:"enforce_ssl_booking";i:0;s:19:"unforce_ssl_booking";i:0;}'; 

foreach($rows as $row){ 
    $fixed = preg_replace_callback('/s:(\d+):"(.*?)";/', function($m){return ($m[1]==strlen($m[2]))?$m[0]:'s:'.strlen($m[2]).':"'.$m[2].'";';},$row['option_value']); 
    $data = unserialize($fixed); 
    foreach($data['seasonal_prices_schema'] as $linie){ 
     echo "<tr>"; 
      echo "<td>{$linie['from']}</td>"; 
      echo "<td>{$linie['to']}</td>"; 
     echo "</tr>"; 
    } 
} 

Ausgang:

<tr> 
    <td>2017-05-11</td> 
    <td>2017-05-12</td> 
</tr> 
<tr> 
    <td>2017-05-13</td> 
    <td>2017-05-14</td> 
</tr> 
// ... lots of repetition ... 
<tr> 
    <td>2017-09-09</td> 
    <td>2017-09-10</td> 
</tr> 
<tr> 
    <td>2017-09-11</td> 
    <td>2018-02-28</td> 
</tr> 
Verwandte Themen