-2

我想使用变量的值并将其分配给数组。

例如 - 此代码有效:

$mf_hook_emails[19734]['Dept Notify'] = 'customer_service@abc.com';

但是此代码不起作用(首先将电子邮件地址分配给变量):

$deptemail='customer_service@abc.com';
$mf_hook_emails[19734]['Dept Notify'] = $deptemail;                        
4

2 回答 2

1
$deptemail='customer_service@abc.com';
$mf_hook_emails[19734]['Dept Notify'] = $deptemail;  

这对我来说很好。print_r($mf_hook_emails)给出:

Array (
       [19734] => Array (
             [Dept Notify] => customer_service@abc.com
             )
      )
于 2013-05-20T13:21:59.907 回答
0

你可以这样定义它:-

 $mf_hook_emails[19734]['Dept Notify'] = (string)$deptemail;
于 2013-05-20T13:23:03.550 回答