当我使用
打印order_item_info数组时echo“
"; print_r($profile['order_item_info']); echo"”;
它打印像这样的数组
一个:74:{S:7: “ITEM_ID”; S:3: “108”; S:8: “quote_id”; S:2: “92”; S:10: “created_at”; S: 19:“2014-06-25 08:32:20”; s:10:“updated_at”; s:19:“2014-06-25 08:32:20”; s:10:“product_id”; s: 1: “6”; S:8: “STORE_ID”; S:1: “1”; S:14: “parent_item_id”; N; S:10: “is_virtual”; S:1: “0”; S: 3:“sku”; s:10:“one-yr-sub”; s:4:“name”; s:8:“One year”; s:11:“description”; N; s:16:“ applied_rule_ids “; S:0:” “S:15:” additional_data “; N; S:13:” free_shipping “; S:1:” 0 “; S:14:” is_qty_decimal “; S:1:” 0 “; S:11:” no_discount “; S:1:” 0 “; S:6:” 重量 “; S:6:” 0.0010 “; S:3:” 数量“; I:1; S:5: “价格”; d:100; S:10: “BASE_PRICE”; d:100; S:12: “custom_price”; N; S:16: “discount_percent”; I:0; S:15: “DISCOUNT_AMOUNT”; I:0; S:20: “base_discount_amount”; I:0; S:11: “征税百分比”; I:0; S:10: “TAX_AMOUNT”; I:0; S:15: “base_tax_amount”; I: 0; S:9: “ROW_TOTAL”; d:100; S:14: “base_row_total”; d:100; S:23: “row_total_with_discount”; S:6: “0.0000”; S:10: “row_weight”; d:0.001000000000000000020816681711721685132943093776702880859375; S:12: “产品类型”; S:6: “简单”; S:24: “base_tax_before_discount”; N; S:19: “tax_before_discount”; N; S :21: “original_custom_price”; N; S:12: “REDIRECT_URL”; N; S:9: “BASE_COST”; N; S:14: “price_incl_tax”; d:100; S:19: “base_price_incl_tax”; d :100; S:18: “row_total_incl_tax”; d:100; S:23: “base_row_total_incl_tax”; d:100; S:17: “hidden_tax_amount”; I:0; S:22: “base_hidden_tax_amount”; I:0 ; S:15: “gift_message_id”; N; S:20: “weee_tax_disposition”; I:0; S:24: “weee_tax_row_disposition”; I:0; S:25: “base_weee_tax_disposition”; I:0; S:29 : “base_weee_tax_row_disposition”; I:0; S:16: “weee_tax_applied”; S:6: “A:0:{}”; S:23: “weee_tax_applied_amount”; I:0; S:27: “weee_tax_applied_row_amount”; I:0; S:28: “base_weee_tax_applied_amount”; I:0; S:30: “base_weee_tax_applied_row_amnt”; N; S:11: “qty_options”;一个:0:{} S:12: “tax_class_id”; S: 1: “0”; S:12: “is_recurring”; S:1: “1”; S:9: “has_error”; b:0; S:10: “is_nominal”; b:1; S:22: “base_calculation_price”; d:100; S:17: “calculation_price”; d:100; S:15: “CONVERTED_PRICE”; d:100; S:19: “base_original_price”; d:100; S:14:“taxable_amount “; d:100; S:19:” base_taxable_amount “; d:100; S:17:” is_price_incl_tax “; b:0; S:14:” ORIGINAL_PRICE“; d:100; S:32: “base_weee_tax_applied_row_amount”; I:0; S:25: “discount_tax_compensation”; I:0; S:20: “base_shipping_amount”; d:5; S:15: “SHIPPING_AMOUNT”; d:5; S:17:“nominal_row_total “; d:105; S:22:” base_nominal_row_total “; d:105; S:21:” nominal_total_details “;一个:0:{} S:15:” info_buyRequest “; S:225:” 一个:4:{ S:4: “uenc”; S:124: “aHR0cDovL2J3Y211bHRpbWVkaWEuY29tL0UvZXh0ZW5zaW9udGVzdC9pbmRleC5waHAvbXVsdGl2ZW5kb3IvdmVuZG9ycHJvZHVjdHMvc3Vic2NyaXB0aW9uLw ,,”; S:7: “产品”; S:1: “6”; S:8: “form_key”; S:16: “be2eDRXu1MC7OXfK”; S:3: “数量”; I:1;}“;}
此数组包含product_id现在我想将该product_id与该数组分开。我怎么能这样做?
答案 0 :(得分:1)
该输出实际上不是数组,而是数组的序列化字符串表示形式,因此您必须首先对其进行反序列化。 (http://www.php.net//manual/en/function.unserialize.php) - 你可以这样做:
$order_item_info = unserialize($profile['order_item_info']);
然后您可以正常访问数组,例如:
print_r($order_item_info['product_id']);