2015年11月12日 星期四

[PHP]htmlentities 跟 htmlspecialchars 的區別

htmlentities

- Convert all applicable characters to HTML entities.
- [ Manual ]

htmlspecialchars

- Convert special characters to HTML entities.

- The translations performed are:
  • '&' (ampersand) becomes '&'
  • '"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
  • "'" (single quote) becomes ''' (or ') only when ENT_QUOTES is set.
  • '<' (less than) becomes '&lt;'
  • '>' (greater than) becomes '&gt;'
- [ Manual ]

沒有留言:

張貼留言