doudeng9425
2018-01-02 16:35
浏览 72
已采纳

如何在PHP的循环中通过数组键cc和bcc取消设置所有邮件头?

Below is how I tried to unset all the mail header array by cc and bcc.

unset(
  $message['cc'], $message['Cc'], $message['CC'],
  $message['headers']['cc'], $message['headers']['Cc'], $message['headers']['CC'],
  $message['params']['headers']['cc'], $message['params']['headers']['Cc'], $message['params']['headers']['CC'],
  $message['bcc'], $message['Bcc'], $message['BCC'],
  $message['headers']['bcc'], $message['headers']['Bcc'], $message['headers']['BCC'],
  $message['params']['headers']['bcc'], $message['params']['headers']['Bcc'], $message['params']['headers']['BCC']
);

There are cc, Ccc, CCC, bcc, Bcc and BCC. I know the above solution is not efficient. How can I replace the above code with a shorter code using for-loop?

图片转代码服务由CSDN问答提供 功能建议

下面是我尝试通过cc和bcc取消设置所有邮件头数组的方法。

  unset(
 $ message ['cc'],$ message ['Cc'],$ message ['CC'],
 $ message ['headers'  ] ['cc'],$ message ['headers'] ['Cc'],$ message ['headers'] ['CC'],
 $ message ['params'] ['headers'] ['cc  '],$ message ['params'] ['headers'] ['Cc'],$ message ['params'] ['headers'] ['CC'],
 $ message ['bcc'],$ 消息['Bcc'],$ message ['BCC'],
 $ message ['headers'] ['bcc'],$ message ['headers'] ['Bcc'],$ message ['headers']  ['BCC'],
 $ message ['params'] ['headers'] ['bcc'],$ message ['params'] ['headers'] ['Bcc'],$ message ['params'  ] ['标题'] ['BCC'] 
); 
   
 
 

cc Ccc CCC bcc Bcc BCC 。 我知道上述解决方案效率不高。 如何使用for-loop用较短的代码替换上面的代码?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题