How to unescape strings in php

青灯夜游
Release: 2023-03-11 11:16:02
Original
2953 people have browsed it

In PHP, you can use the stripslashes() function to reverse-escape the string. This function can restore the escaped string and delete the backslash added by the addslashes() function. The syntax format is " stripslashes(string)"; this function returns the raw, unescaped string.

How to unescape strings in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

php string reverse Escape

You can use the stripslashes() function, which can restore the escaped string and delete the backslashes added by the addslashes() function.

Syntax format:

stripslashes(string)
Copy after login

This function returns the original string without escaping, and the parameterstringis the escaped string.

The example of restoring the escaped string is as follows:

"; echo stripslashes($str1) . "
"; ?>
Copy after login

The execution result of the above program is:

I don\'t love you I don't love you
Copy after login

Recommended learning: "PHP Video tutorial

The above is the detailed content of How to unescape strings in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!