Hướng dẫn php escape special characters

[PHP 4, PHP 5, PHP 7, PHP 8]

Nội dung chính

  • Description
  • Return Values
  • What is escaping special characters in PHP?
  • How do I allow special characters in PHP?
  • What is the use of Htmlspecialchars in PHP?
  • What is the difference between Htmlentities and Htmlspecialchars in PHP?

addslashesQuote string with slashes

Description

addslashes[string $string]: string

  • single quote [']
  • double quote ["]
  • backslash [\]
  • NUL [the NUL byte]

A use case of addslashes[] is escaping the aforementioned characters in a string that is to be evaluated by PHP:


if you need to quote SQL strings it's

Chủ Đề