thinkPHP的用法之M
M方法
//添加
$res = M('comment')->add($data); //成功返回新增ID,失败返回false
//删除
M('myop_myinvite')->where($map)->delete(); //成功返回删除记录个数,失败返回false
//保存
M('user')->where("uid={$this->mid}")->data($data)->save(); //data为数组,成功返回影响的行数,失败返回false
M('user')->setField('domain',$domain,'uid='.$this->mid); == M('user')->where($map)->setField('email', $_POST['email']) //成功返回影响的行数,失败返回false
//查询
$user = M('user')->where('uid='.$this->mid)->field('email,uname')->find(); //单记录
$count = M( 'UserTag' )->where( 'uid='.$this->mid )->count(); //查询条数
M('comment')->where('`id`='.$_POST['to_id'])->getField('uid'); //按字段查询
M('WeiboAttach')->where("weibo_type=1")->limit(10)->order("weibo_id DESC")->findAll(); //查询所有记录
$res= M('myop_myinvite')->where($map)->order('appid DESC')->findPage('10'); //每页10条记录
//原始执行sql语句
$res= M('')->query($sql);
M()->execute($sql);
//调试
dump(M('')->getLastSql());