In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how php escapes strings into special characters". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Escape character description
In double quotation marks, all escape characters can be used normally.
In single quotation marks, only single quote escape characters can be used ("), and nothing else can be used.
2. Using mysql library function
The PHP version is prior to 7.0:
Mysql_escape_string (string $unescaped_string): string
The PHP version is later than 7.0:
Mysqli_real_escape_string (mysqli $link, string $escapestr): string
3. Using the escape function addslashes ()
Suitable for version PHP4, PHP5, PHP7
Addslashes (string $str): string
Before PHP 5.4.The PHP instruction magic_quotes_gpc defaults to on, and virtually all GET, POST, and COOKIE data are used by addslashes (). Do not use addslashes () on strings that have already been escaped by magic_quotes_gpc, as this will result in double-layer escape. You can use the function get_magic_quotes_gpc () to detect when you encounter this situation. That is, when get_magic_quotes_gpc () returns false, addslashes () is used for special character escape. Examples are as follows:
Function myaddslashes ($data) {if (false = = get_magic_quotes_gpc ()) {return addslashes ($data); / / when magic reference is not enabled, escape special characters} return $data;} "how php escapes strings into special characters" ends here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.