开发者

Determining when or when not to escape output

I have a page, where I have approximately 90 items I need to output. Most of them are object properties (I am using ORM so these objects map to my database tables). But the question is, do I have to encode each of those开发者_Go百科 90 outputs by applying functions to each (in my case, the htmlspecialchars)? Wouldn't that add a bit of an overhead (calling a single function 90 times)?

EDIT: The term is "output encoding"...hehe


Someone will, at some point, enter data that can mess up your HTML page. They may do this accidentally (the company name has an ">" in it), or intentionally (see XSS).

So, yes, always properly encode output.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜