insert($url, $short, $status, $create_time);增:$db = M( Url );$filed = array( url => $url.$i, sh..."/>
您好,登錄后才能下訂單哦!
調(diào)用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();
這種寫法是綁定參數(shù)的寫法
改:
$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():條件可以是字符串或是數(shù)組
field():要查詢的字段
Thinkphp3.2開發(fā)手冊:http://document.thinkphp.cn/manual_3_2.html#delete_data
免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。