全文预览

phalcon笔记大全

上传者:业精于勤 |  格式:docx  |  页数:19 |  大小:67KB

文档介绍
eate();Р//Passing an array to createР$robot = new Robots();Р$robot->create(array(Р 'type' => 'mechanical',Р 'name' => 'Astroy Boy',Р 'year' => 1952Р));Р更新: update() 或 save()Р//Updating a robot nameР$robot = Robots::findFirst("id=100");Р$robot->name = "Biomass";Р$robot->update();Р//Passing an array to updateР$robot->create(array(Р 'name' => 'Biomass'Р),array('name'));//第二个参数用于指定允许设置的字段的名称,不指定的话则表示允许数据表内全部字段名称的键。Р如果传入的数组的键与数据表字段名不一致,可以使用$robot->assign(<数组>, <键值分别为数组键名与数据表字段名组成的数组>, <允许的字段>)来赋值。例如:Р$robot = new Robots();Р$robot->assign(Р array(Р 'name' ='Biomass'Р ),Р array('name'=>'user_name'),Р array('user_name')Р);Р$robot->create();Р删除: delete()Р$robot = Robots::findFirst("id=100");Р$robot->delete();Рforeach (Robots::find("type = 'mechanical'") as $robot) {Р $robot->delete();Р}Р运算:Рcount()

收藏

分享

举报
下载此文档