Home >Backend Development >PHP Problem >How to remove backslash in php5.2

How to remove backslash in php5.2

藏色散人
藏色散人Original
2021-11-19 09:44:271933browse

php5.2 Method to remove backslashes: 1. Create a new php file; 2. Create a variable $str to save strings with backslashes; 3. Use the stripslashes function to remove characters A backslash in the string will do.

How to remove backslash in php5.2

The operating environment of this article: windows7 system, PHP5.2 version, DELL G3 computer

How to remove backslashes in php5.2 ?

Create a new php file named test.php to explain how to remove backslashes from strings in php.

How to remove backslash in php5.2

In the test.php file, use the header() method to set the encoding format of the page to utf-8 to avoid outputting Chinese garbled characters.

How to remove backslash in php5.2

In the test.php file, create a variable $str to save the string with backslashes.

How to remove backslash in php5.2

In the test.php file, use the stripslashes() function to remove backslashes from the string and save them in the $newstr variable.

How to remove backslash in php5.2

In the test.php file, use echo to output the string with the backslash removed.

How to remove backslash in php5.2

Open the test.php file in the browser to view the results.

How to remove backslash in php5.2

Recommended study: "PHP Video Tutorial"

The above is the detailed content of How to remove backslash in php5.2. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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