我有一个数组:
Array
(
[0] => Array
(
[id] => 11
[email_theme_id] => 1_5
[email_template] => Array()
[add_template] =>
[email_template_subject] => Your free and bargain ebook alert for Sunday
[last_update] => 1392314609
)
[1] => Array
(
[id] => 10
[email_theme_id] => 2_12
[email_template] => Array()
[add_template] =>
[email_template_subject] => Your free and bargain ebook alert for Sunday
[last_update] => 1392314609
)
)
我需要更改数组项[1] [email_template]值,那么我该如何用PHP做呢?
答案 0 :(得分:1)
试试:
$data[1]['email_template'] = 'new value';
$data
是您的数据变量。
答案 1 :(得分:0)
尝试
$item[1][email_template] = array('new value');
甚至你可以这样做
$item[1][email_template][0] = 'new value';
考虑到您要更新阵列