4 articles about escaping slashes recommended

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.