我得到 NULL ::字符变化作为CakePHP 3中Form的值,因为我刚创建新实体时我希望它是空白的。 我使用的控制器代码是
public function add() {
$audience = $this->Audiences->newEntity();
$this->set(compact('audience', 'languages'));
$this->set('_serialize', ['audience']);
在add.ctp中,我的代码重做表单是
echo $this->Form->create($audience, ['novalidate' => true]);
echo $this->Form->input('audience', ['type' => 'text']);