Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张表格,人们可以一起注册/付款。
我正在使用 saveAll() 向支付表中添加一行,向用户表中添加一行。唯一的问题是,我的 user_id 没有与付款数据一起保存。
获取新创建的 user_id 并将其与付款数据一起保存的最佳方法是什么?
if($this->Post->saveAll($post)) { $user_id=$this->Post->inserted_id; //get last insert_id }
然后将此 $user_id 与付款数据绑定并保存。