Questions about escaping (replacing strings) strings containing Chinese characters-php Tutorial

Source: Internet
Author: User
For example, if I want to replace the escape character in a string with \, but the character string "escape character" does not exist, it is only because the second byte of "bytes" is the same as the value, so it is changed to "\". it is displayed as "bytes". how can this problem be solved? ------ Solution -------------------- it is not clear what you mean to try the php replacement function str_replace () to escape (replace strings) strings containing Chinese characters
For example, I want to replace \ escape \\
However, the string "bytes" does not contain \, but the second byte of "bytes" is the same as the value of \, so it is replaced \\, this shows that it is "too many \".
How can this problem be solved?

------ Solution --------------------
Not very clear what you mean
Try the php replacement function str_replace ()
------ Solution --------------------
Remove the slash from stripslashes
This function removes the backslash from the string.
If there are two backslash lines in a row, remove one and leave one. If there is only one backslash, remove it directly.

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.