正常的SQL是:
select * from post where id = '10';
这里是注入的点:
10" union select id,username,salt,password,5 from user where id="2
对注入的内容进行转义后:
select * from post where id = '10\" union select id,username,salt,password,5 from user where id=\"2'
不懂为啥能查询出数据?
你的 id MYSQL设置是数字类型,但是你查询的却是字符类型。这时候,MYSQL会进行隐式转化并且不会使用索引。其中字符转数字: