Home >Backend Development >PHP Problem >How to remove backslash in php5.2
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.
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.
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.
In the test.php file, create a variable $str to save the string with backslashes.
In the test.php file, use the stripslashes() function to remove backslashes from the string and save them in the $newstr variable.
In the test.php file, use echo to output the string with the backslash removed.
Open the test.php file in the browser to view the results.
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!