Zend 框架清理数据 [英] zend framework sanitizing data
问题描述
我在各处看到不同的评论,有人说 Zend 框架会自动清理 post/get 数据,但其他人说它不会.
I've seen different comments all over the place, some say that zend framework automatically sanitizes post/get data but others say it doesn't.
怎么回事?我已经看到在 predispatch 中使用 getParams 上的 foreach 执行此操作是最快的方法,但有人有任何建议吗?
What's the deal? I've seen that doing it in the predispatch with a foreach on getParams is the quickest way, but does anyone have any suggestions?
推荐答案
可能是关于 Zend_Controller_Request
与 Zend_Db
的交易.请求数据经常被放入数据库中.
Probably the deal is about Zend_Controller_Request
vs the Zend_Db
. Request data are often put into the DB.
请求对象不会转义任何内容.您可以强制它使用过滤器、表单过滤器或例如使用此处描述的反射技术:
Request object does not escape anything. You may force it to do using filters, form filters or e.g. using the reflection technique described here:
Zend_Db
查询基本上像在其他 ORM 中一样被转义,例如在 PDO.
Zend_Db
queries are basically escaped like in other ORM's, like in PDO.
这篇关于Zend 框架清理数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!