5

我有一个数组,其中包含一些看起来像这样的数据

$valueOptions = array(
                       'order_shipping_data_firstname' => Mage::helper('orders2csv')->__('order shipping firstname'), 
                       'order_shipping_data_lastname' => Mage::helper('orders2csv')->__('order shipping lastname'),
                       'order_shipping_data_region' => Mage::helper('orders2csv')->__('order shipping region'),
                       'order_shipping_data_street' => Mage::helper('orders2csv')->__('order shipping street'),
                       'order_shipping_data_city' => Mage::helper('orders2csv')->__('order shipping city')
                );

我需要结合名字和姓氏字段,但无法找到解决方案。这是模块中唯一引用任何姓氏/名字/名字的文件,因此它从magento框架内从外部调用它。理想情况下,它们将存储在变量中,我可以将它们组合起来 $fullname = $first 。$last 等,但这在数组中不起作用。

我不太了解 的用法,=>但我知道是否编辑右侧并进行此操作:=> Mage::helper('orders2csv')->__('order shipping fullname')该选项将出现在我想要的位置(在下拉列表中),所以我想我正在尝试将其合并'order_shipping_data_firstname'&'order_shipping_data_lastname'并放在之前这个,但在数组内?

我还尝试在变量中启动另一个数组并将变量插入 valueOptions 数组中,但这坏了。

4

2 回答 2

3
$foo = array(
    'bar' => array(
        "hello",
        "world"
    ),
);
var_dump($foo);

数组嵌套在数组中

于 2012-12-20T05:28:50.527 回答
1

试试这个:

$orders = Mage::helper('orders2csv');
$valueOptions = array(
        'order_shipping_data_firstname' => $orders->__('order shipping firstname'), 
        'order_shipping_data_lastname' => $orders->__('order shipping lastname'),
        'order_shipping_data_fullname' => $orders->__('order shipping firstname').' '.$orders->__('order shipping lastname'),
        'order_shipping_data_region' => $orders->__('order shipping region'),
        'order_shipping_data_street' => $orders->__('order shipping street'),
        'order_shipping_data_city' => $orders->__('order shipping city')
);

或这个:

$orders = Mage::helper('orders2csv');
$valueOptions = array(
        'order_shipping_data_firstname' => $orders->__('order shipping firstname'), 
        'order_shipping_data_lastname' => $orders->__('order shipping lastname'),
        'order_shipping_data_fullname' => $orders->__('order shipping fullname'),
        'order_shipping_data_region' => $orders->__('order shipping region'),
        'order_shipping_data_street' => $orders->__('order shipping street'),
        'order_shipping_data_city' => $orders->__('order shipping city')
);
于 2012-12-20T05:29:24.680 回答