相关疑难解决方法(0)

Cakephp中的getLastInsertId()相当于什么?

如果我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

50
推荐指数
10
解决办法
12万
查看次数

标签 统计

cakephp ×1