对此有一些实际问题,希望有人能提供帮助。这是我正在使用的数据的简化样本。所以这里 $order_info 是一个数组,在该数组内部还有另一个名为 $items 的数组,其中有多个以项目 ID 作为名称的数组(非常烦人!)。我想要做的是遍历 $items 数组中的数组——问题是我不知道它们的名字。是否可以只循环遍历数组中的每个数组(也在数组中!)?它还需要使用 smarty。我尝试了各种嵌套的 for 循环,但都返回一个空白页,提示错误。
{$order_info} Array (86)
order_id => "15"
items => Array (2)
4008222099 => Array (19)
item_id => "4008222099"
order_id => "15"
product_id => "836"
product_code => "B0001WS6L2"
price => "229.95"
amount => "1"
extra => Array (9)
step => "1"
product_options => Array (0)
unlimited_download => "N"
product => "LINGO TR-2203 Pacifica Talk Talking T..."
company_id => "0"
is_edp => "N"
edp_shipping => "N"
base_price => "229.95"
stored_price => "N"
product => "LINGO TR-2203 Pacifica Talk Talking T..."
deleted_product => ""
discount => "0"
company_id => "0"
base_price => "229.95"
original_price => "229.95"
cart_id => "4008222099"
tax_value => "0"
subtotal => "229.95"
display_subtotal => "229.95"
shipped_amount => "0"
shipment_amount => "1"
1157311813 => Array (19)
item_id => "1157311813"
order_id => "15"
product_id => "744"
product_code => "B00028DM96"
price => "119.99"
amount => "1"
extra => Array (9)
step => "1"
product_options => Array (0)
unlimited_download => "N"
product => "Sharp Electronics PW-E550 Electronic ..."
company_id => "0"
is_edp => "N"
edp_shipping => "N"
base_price => "119.99"
stored_price => "N"
product => "Sharp Electronics PW-E550 Electronic ..."
deleted_product => ""
discount => "0"
company_id => "0"
base_price => "119.99"
original_price => "119.99"
cart_id => "1157311813"
tax_value => "0"
subtotal => "119.99"
display_subtotal => "119.99"
shipped_amount => "0"
shipment_amount => "1"