我想使用变量的值并将其分配给数组。
例如 - 此代码有效:
$mf_hook_emails[19734]['Dept Notify'] = 'customer_service@abc.com';
但是此代码不起作用(首先将电子邮件地址分配给变量):
$deptemail='customer_service@abc.com';
$mf_hook_emails[19734]['Dept Notify'] = $deptemail;
我想使用变量的值并将其分配给数组。
例如 - 此代码有效:
$mf_hook_emails[19734]['Dept Notify'] = 'customer_service@abc.com';
但是此代码不起作用(首先将电子邮件地址分配给变量):
$deptemail='customer_service@abc.com';
$mf_hook_emails[19734]['Dept Notify'] = $deptemail;
$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
)
)
你可以这样定义它:-
$mf_hook_emails[19734]['Dept Notify'] = (string)$deptemail;