是否有办法确定一个能够过滤干扰的外向的普通建筑?
Definitely NO.
很久以前就存在这样的情况,但现在,它却挥之不去,被歪曲和夸大(因为它从未像用意那样做,也没有达到目的)。
The problem you face is coming from the fact that SQL query being a program.
So, you have to follow the syntax rules creating this program, just like with any other program language. If you happen to create a PHP program, you have to take care of the irritating apostrophes as well - you can t put it all over the code in random places, but each have to have it s strict syntactical meaning, or - if an apostrophe being part of the data - it have to be properly escaped.
So, it is just syntax issue.
The best way to solve the problem is to separate the code from the data.
Native prepared statements gives you that possibility.
You can create a program - the query itself - and eventually bind some variables to it, so, the program code and the date being sent to the SQL server separately.
That s why prepared statements considered the best way of creating dynamical SQL queries.
但是,当然,你们必须把每个变量都明确地加以约束——因此,没有普遍的方法。
然而,你可以利用一些助手自动地履行具有约束力的义务,因此,该守则变得简明扼要。
$db->run("SELECT * FROM table WHERE id=?",$id);
这样做既短于书面,又完全安全。