Blogger Information
Blog 81
fans 1
comment 0
visits 124105
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
tp 模型中的Replace()的作用
有什么是忘不了的的博客
Original
3899 people have browsed it

Replace:字面意思就是替换。

他是用来判断添加的这条语句 根据主键判断是否存在。

        存在则替换

        不存在则新增

用法如:

        $user = new User(); //实例化一个模型类

        $user->replace()->save(['ad_id'=>95,'pid'=>30,'hahah'=>30]);// ad_id主键

    第一次添加pid=80

    49DUE~}ON)`8%})%Y%~~354.png

    再次执行pid=30

    E%G88P)YN8X@A09}[$VE%DN.png

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post