在thinkphp的控制器中写sql语句的时候,哪种写法是正确的?$result=$m->where('username="'.$user.'"')->find();$result=$m->where('username='.$user)->find();【代码A】publicfunctioncheckuser(){$user=I('post.user');$m=M('users');$result=$m->where('username="'.$user.'"')->find();$this->ajaxReturn($result);}【代码B】publicfunctioncheckuser(){$user=I('post.user');$m=M('users');$result=$m->where('username='.$user)->find();$this->ajaxReturn($result);}
收到一只叮咚
相关分类