以下是输出数组的示例:
Array ( [CART] => Array ( [ITEMS] => Array ( [0] => Array ( [product_id] => 269194 [variation_id] => 0 [options] => Array ( ) [quantity] => 1 [product_name] => 15 Top Hits for Easy Piano [product_code] => HL102668 [product_price] => 14.9900 [original_price] => 14.9900 [default_currency] => 1 [customer_group] => [product_fields] => Array ( ) ) [1] => Array ( [product_id] => 266421 [variation_id] => 0 [options] => Array ( ) [quantity] => 1 [product_name] => Whistle [product_code] => HD245839 [product_price] => 3.9900 [original_price] => 3.9900 [default_currency] => 1 [customer_group] => [product_fields] => Array ( ) ) ) [LAST_UPDATED] => 1349829499 [NUM_ITEMS] => 2 ) [JustAddedProduct] => [CHECKOUT] => Array ( ) )
每个独特产品都有一个数组(在此示例中,有 2 个独特产品。)有时只有一个,有时可能有 20 个或更多独特产品。
对我来说重要的价值是 [product_code]。您可以看到在第一个数组中,有 [product_code] => HL102668。第二个是 [product_code] => HD245839。
如何检查任何 [product_code] 值中是否存在“HD”?如果是这样,我需要返回false。
感谢您的帮助!