CopyCode The Code is as follows: <? PHP
$ Zongzi = "ASDFASDF (ASDFASDF? Asfdadsf )";
Echo $ zongzi = quotemeta ($ zongzi );
Echo "<br/> ";
$ Zongzi = stripslashes ($ zongzi );
Echo $ zongzi;
?>
PHP quotemeta () function
Definition and usage
The quotemeta () function adds a backslash before some predefined characters in the string.
The predefined characters are:
Period (.)
Backslash (\)
Plus sign (+)
Asterisk (*)
Question mark (?)
Square brackets ([])
Escape Character (^)
Dollar sign ($)
Parentheses (())
Syntax
Quotemeta (string)
Parameters |
Description |
String |
Required. Specifies the string to be checked. |
Tips and comments
Tip: this function can be used to escape characters with special meanings, such as (), [], and * in SQL *.Copy codeThe Code is as follows: <? PHP
$ STR = "Hello world. (can you hear me ?) ";
Echo quotemeta ($ Str );
?>
Output:
Hello world \. \ (Can You Hear Me \? \)