问题描述
我正在研究CakePHP 3项目。我希望我的用户可以将邮件发送给多个收件人。我正在面对问题,我无法一次插入多个复选框的值。PLz帮助我。谢谢你英语不好。
控制器代码
style="word-spacing: 30px;"
表单代码
/**
* Add method
*
* @return \Cake\Http\Response|null Redirects on successful add,renders view otherwise.
*/
public function add()
{
$this->loadModel("Users");
$OrganizationId = $this->Auth->user(['OrganizationId']);
$Users = $this->Users->find('all');
$this->set('Ulist',$Users);
$usernamer = $this->Auth->user(['username']);
$senderId = $this->Auth->user(['PId']);
$mail = $this->Mail->newEntity();
if ($this->request->is('post')) {
$this->request->data['Date'] = date("Y/m/d");
$this->request->data['Sender'] = $usernamer;
$this->request->data['SenderId'] = $senderId;
$this->request->data['Type'] = $senderId;
$mail = $this->Mail->patchEntity($mail,$this->request->getData());
if ($this->Mail->savemany($mail)) {
$this->Flash->success(__('The mail has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The mail Could not be saved. Please,try again.'));
}
$this->set(compact('mail'));
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)