2 回答

TA貢獻1936條經驗 獲得超7個贊
您有多種選擇,可以在數組中定義鍵:
$interestsAdd = [1,2,3];
$dataToReset = array (
'email_address' => 'x',
'status' => 'subscribed',
'interests' => $interestsAdd
);
或者之后添加:
$interestsAdd = [1,2,3];
$dataToReset = array (
'email_address' => 'x',
'status' => 'subscribed',
);
$dataToReset['interests'] = $interestsAdd;
或者與您當前的結構合并它們:
$interestsAdd = ['interests' => [1,2,3]];
$dataToReset = array_merge($dataToReset, $interestsAdd);

TA貢獻1829條經驗 獲得超6個贊
嘗試像這樣設置你的第一個數組:
$dataToReset = [
'email_address' => $subEmail,
'status' => 'subscribed',
'interests' => [],
];
構建 $interestsAdd 數組后,將其添加到第一個數組:
$dataToReset['interests'] = $interestsAdd;
- 2 回答
- 0 關注
- 132 瀏覽
添加回答
舉報