我在 UsersController 中有一个方法
public function addMailbox($data)
{
$this->LoadModel('Mailbox');
$mailbox = $this->Mailbox->newEntity();
$mailbox->username = $data('username');
$mailbox->name = $data('name');
if ($this->Mailbox->save($mailbox)) {
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('Error'));
}
,代码在粘贴到 add() 方法时工作正常,但在使用后
$this->addMailbox($this->request->getData());
我得到的只是错误:函数名必须是字符串
有任何想法吗?