1 #是将传入的值当作字符串的形式,eg:select id,name,age from student where id =#{id},当前端把id值1,传入到后台的时候,就至关于 select id,name,age from student where id ='1'.html
2 $是将传入的数据直接显示生成sql语句,eg:select id,name,age from student where id =${id},当前端把id值1,传入到后台的时候,就至关于 select id,name,age from student where id = 1.前端
3 使用#能够很大程度上防止sql注入。sql
4 可是若是使用在order by 中就须要使用 $.post
5 在大多数状况下仍是常用#,但在不一样状况下必须使用$. url