Phalcon获取最后插入ID lastInsertId

<?php
    $model = new model();
    
    if($model -> create($data)) {
        $insertId = $model -> getWriteConnection() -> lastInsertId($model -> getSource());
    }
?>

是的没错,就是如此的简单!

还可以在简单一点!

<?php
    $model = new model();
    
    if($model -> create($data)) {
        $insertId = $model -> id;
    }
?>


本文出自 “天道酬勤” 博客,请务必保留此出处http://ivendor.blog.51cto.com/8613733/1576500

文章来自:http://ivendor.blog.51cto.com/8613733/1576500
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3