Prestashop Tools::getValue()函数不逃避sql注入?
Prestashop Tools::getValue() function do not escape sql injection?
我在 prestashop 论坛上看到函数 Tools::getValue()
不会逃避 sql 注入。现在我想知道当我想获取字符串或整数值时如何防止此函数被 sql 注入?
谁能给我举个例子?
Tools::getValue()
仅检索 POST 或 GET 值。
要防止 SQL 注入,您可以使用 pSQL()
函数,或者对于 int 值,您可以进行类型转换。
$int_val = (int)Tools::getValue('someValue');
$string_val = pSQL(Tools::getValue('someValue'));
我在 prestashop 论坛上看到函数 Tools::getValue()
不会逃避 sql 注入。现在我想知道当我想获取字符串或整数值时如何防止此函数被 sql 注入?
谁能给我举个例子?
Tools::getValue()
仅检索 POST 或 GET 值。
要防止 SQL 注入,您可以使用 pSQL()
函数,或者对于 int 值,您可以进行类型转换。
$int_val = (int)Tools::getValue('someValue');
$string_val = pSQL(Tools::getValue('someValue'));