在我的序列化数据下面,我想要反序列化。
怎么可能?
array(5) {
[0]=>
string(970) "a:7:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:4:{i:0;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:13:"base_subtotal";s:8:"operator";s:2:">=";s:5:"value";s:3:"100";s:18:"is_value_processed";b:0;}i:1;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:14:"payment_method";s:8:"operator";s:2:"==";s:5:"value";s:24:"paypal_billing_agreement";s:18:"is_value_processed";b:0;}i:2;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:9:"region_id";s:8:"operator";s:2:"!=";s:5:"value";s:3:"321";s:18:"is_value_processed";b:0;}i:3;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:9:"total_qty";s:8:"operator";s:2:"==";s:5:"value";s:2:"30";s:18:"is_value_processed";b:0;}}}"
[1]=>
string(398) "a:7:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:15:"shipping_method";s:8:"operator";s:2:"==";s:5:"value";s:5:"dhl_M";s:18:"is_value_processed";b:0;}}}"
[2]=>
string(390) "a:7:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:10:"country_id";s:8:"operator";s:2:"==";s:5:"value";s:2:"AS";s:18:"is_value_processed";b:0;}}}"
[3]=>
string(619) "a:7:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:7:{s:4:"type";s:56:"Magento\SalesRule\Model\Rule\Condition\Product\Subselect";s:9:"attribute";s:3:"qty";s:8:"operator";s:2:"==";s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Product";s:9:"attribute";s:5:"color";s:8:"operator";s:2:"==";s:5:"value";s:2:"52";s:18:"is_value_processed";b:0;}}}}}"
[4]=>
string(390) "a:7:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Combine";s:9:"attribute";N;s:8:"operator";N;s:5:"value";s:1:"1";s:18:"is_value_processed";N;s:10:"aggregator";s:3:"all";s:10:"conditions";a:1:{i:0;a:5:{s:4:"type";s:46:"Magento\SalesRule\Model\Rule\Condition\Address";s:9:"attribute";s:8:"postcode";s:8:"operator";s:2:"==";s:5:"value";s:5:"46487";s:18:"is_value_processed";b:0;}}}"
}
答案 0 :(得分:3)
您可以通过以下方式使用foreach()
和unserialize()
: -
$unserialized = array();
foreach ($data as $serialized) {
$unserialized[] = unserialize($serialized);
}