我在想,是否还有另外一种方法,在同一个表格上插入用户代号,用“cakephp like”插入多个插入。例如,我的工作是:
$user_id = $this->Auth->user( id );
if ($this->request->is( post )) {
foreach ($this->request->data[ Post ] as $key => $value) {
if (is_int($key)) {
$this->request->data[ Post ][$key][ user_id ] = $user_id;
}
unset($key);
unset($value);
}
debug($this->data[ Post ]);
die();
$this->Post->saveAll($this->data[ Post ]);
}
I don t use input hidden value user_id for serurity reason. Thanks for your help !