Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php mysql\u real\u escape\u string-like函数_Php_Mysql_Orm_Propel - Fatal编程技术网

Php mysql\u real\u escape\u string-like函数

Php mysql\u real\u escape\u string-like函数,php,mysql,orm,propel,Php,Mysql,Orm,Propel,我正在使用推进。我正在将描述发布到页面并通过查询保存 $desc="my school's is here that why "" i have work"; // this data is posting by my form input. $education->setEddescription($desc); $education->save(); 但在数据库中,它并没有转义“和”值 谢谢。参考: Propel不仅使用PDO进行查询,还通过PDO使用准备好的语句,这在

我正在使用推进。我正在将描述发布到页面并通过查询保存

$desc="my school's is here that why "" i have work";    // this data is posting by my form input.
$education->setEddescription($desc);
$education->save();
但在数据库中,它并没有转义“和”值

谢谢。

参考:

Propel不仅使用PDO进行查询,还通过PDO使用准备好的语句,这在减轻SQL注入攻击(和提高性能)方面非常好

请注意,仅使用PDO并不能保证对SQL注入有任何保护,请始终使用准备好的语句


因此,作为对您问题的回答,是的,spreep充分利用了PDO的能力来防止SQL注入。

ORMs对SQL查询上下文进行转义(spreep使用绑定参数)。数据库不需要存储任何转义的内容,只需要存储实际值。您可能在其他地方有代码问题吗?我正在用json打印该描述。“描述”:“我的学校在这里”“为什么我有工作”并在jsonWell中出错,然后不手动分析无效的JSON。有
json\u encode()
可以正确处理事情。