【发布时间】:2019-11-22 11:07:50
【问题描述】:
我有一个这样的数组:
$allauto = [
'name' => $title,
'type' => 'simple',
'description' => $description,
'attributes' => [
[
'id' => 1,
'visible' => true,
'options' => $model,
],
我有一个这样的数组 $addimage:
$addimage = [
'images' [
'src' => xxxxx
'src' => yyyyy
],
]
我如何结合这些(与 array_push)?所以我得到这样的结果:
$allauto = [
'name' => $title,
'type' => 'simple',
'description' => $description,
'attributes' => [
[
'id' => 1,
'visible' => true,
'options' => $model,
],
'images' => [
[
'src' => xxxxx
'src' => yyyyyy
]
我用 array_push 尝试了不同的东西,但我在 2 个数组之间得到了 0 和 1 之类的键... 有人可以帮忙吗?
【问题讨论】:
-
您的示例包含语法错误
-
试试这个:$allauto['images'] = $addimage['images'];
标签: php array-push