源数组:
$attributes = array(
    'Users' => array(
        'Name' => 'Name',
    ),
    'Address' => 'Address',
    'Tags' => array(
        0 => array(
            'Key' => 'Key',
            'Value' => 'Value',
        ),
        1 => array(
            'Key' => 'Key',
        ),
        2 => array(
        )
    ),
);
希望转换为如下数组:
$result = array(
    'Users_Name' => 'Name',
    'Address' => 'Address',
    'Tags_0_Key' => 'Key',
    'Tags_0_Value' => 'Value',
    'Tags_1_Key' => 'Key',
    // 'Tags_2' => '',
);
递归方式尝试了半天,依然没有解决,如何转换呢?
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
如果那个空数组也要转换的话自己再分个类就好啦。