When I recently saved a link to a MySQL database using a crawler crawl, I found that when I saved the link using Json_encode, I showed the escape character in the database, which I didn't need to escape, look unclear, and take up storage space. It was later found that the JSON-formatted conversion using Json_encode arrays in the default case would automatically escape strings with slashes in the data, but often we don't need to escape them at times, so this article says how to use Json_encode Does not automatically escape slashes. For the following array $a, there are two solutions available: $a = array (' http://www.baidu.com ', ' http://www.baidu.com ', ' http://www.baidu.com ', ' Http://www.baidu '.
1. Let Json_encode not automatically escape the slash "/" in PHP
Introduction: This article mainly to share in PHP how to let Json_encode do not automatically escape the slash "/" of the two methods, the text gives a detailed example code, I believe that we have a certain reference value, the need for friends below to see it together.
2. Questions about character escapes
Description: Character escaping problems such as this string [Td]for God's sake! [/TD] I escaped the single quotation mark and stored it in the database. When the article is displayed, the articles are found with escape slashes. Instead of escaping directly into the database, sometimes inserting the database is an error. What's the deal? Convert some special characters function format_html ($str) {$str = Str_repl
3. Why should I escape? Solution Ideas
Introduction: Why to escape it str_replace (' \, '/', dirname (__file__))), the upper part of the red is the escape slash, why do you want to turn------solution----------------------because it is a special character. ------to solve the idea----------------------just to make it into a normal character, let him lose the meaning of language
4. Questions about character escapes
Description: Character escaping problems such as this string [Td]for God's sake! [/TD] I escaped the single quotation mark and stored it in the database. When the article is displayed, the articles are found with escape slashes. Instead of escaping directly into the database, sometimes inserting the database is an error. What's the deal? Convert some special characters function format_html ($str) {$str = Str_repl