朋友写了一个小脚本来获取所选商品的商品id和商品数量。这里是:
$product_id_string = $_POST['custom'];
$product_id_string = rtrim($product_id_string, ",");
$id_values = array();
$id_str_array = explode(",", $product_id_string);
$fullAmount = 0;
foreach ($id_str_array as $key => $value) {
$id_quantity_pair = explode("-", $value);
$product_id = $id_quantity_pair[0]; // product ID
$product_quantity = $id_quantity_pair[1]; // product quantity
}
我是怎么理解的...产品ID及其数量是从自定义变量中读取的?问候!