您好,登录后才能下订单哦!
调用model
D('ModelName')->insert($url, $short, $status, $create_time);
增:
$db = M('Url');
$filed = array(
'url' => $url.$i,
'short' => $short.$i,
'status' => $status,
'create_time' => $create_time
);
$status = $db->add($filed);
查:
$where = "status=%d";
$data = M('Url')->where($where, array(1))->field('id uid, url curl')->select();
这种写法是绑定参数的写法
改:
$where['id'] = array(13,14);
$field['url'] = "http://cribn.org";
$field['short'] = "http://cribn.org";
$status = M('Url')->where($where)->save($field);
Sql:UPDATE `url` SET `url`='http://cribn.org',`short`='http://cribn.org' WHERE ( (`id` = 13) AND (`id` = 14) );
删:
$where['id'] = 74;
$status = M('Url')->where($where)->delete();
M():实例化当前组下边的model
D():如果当前组下不存在model会去其他组里边实例化
find():查询一条记录
select():查询多条记录
where():条件可以是字符串或是数组
field():要查询的字段
Thinkphp3.2开发手册:http://document.thinkphp.cn/manual_3_2.html#delete_data
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。