如果我getLastInsertId()在a之后立即做save(),它可以工作,但否则它不会.这在我的控制器中得到证明:
function designpage() {
//to create a form Untitled
$this->Form->saveField('name','Untitled Form');
echo $this->Form->getLastInsertId(); //here it works
}
function insertformname() {
echo $this->Form->getLastInsertId(); //this doesnt echo at all
}
Run Code Online (Sandbox Code Playgroud)
请建议一种获得我想要的功能的方法.
cakephp ×1