mybatis中#{}与${}的区别 mybatis中#{}与${}的差别(如何防止sql注入)

参考文章:

MyBatis常见面试题1:精讲#{}和${}的区别是什么?

http://www.mybatis.cn/archives/70.html

mybatis中#{}与${}的差别(如何防止sql注入)

https://www.cnblogs.com/chihirotan/p/6071801.html

${ }方式一般用于传入数据库对象,例如传入表名,列名,使用order by时。但是使用${ }要通过手工编码对传入的参数进行验证,以防止SQL注入。

猜你喜欢

转载自www.cnblogs.com/blogfortang/p/mybatis_difference.html