#{}代表的是占位符,它可以防止sql注入:select * from userinfo where id=#{id}这里可以用id=?替换; ${}不能够防止sql注入,select * from userinfo where id=${id} 这里只能用id=2(某一个具体数字代替).