Copy CodeThe code is as follows:
$zongzi = "ASDFASDF (ASDFASDF?ASFDADSF)";
echo $zongzi = Quotemeta ($zongzi);
echo "
";
$zongzi = Stripslashes ($zongzi);
Echo $zongzi;
?>
PHP Quotemeta () function
Definition and usage
The Quotemeta () function adds a backslash before some of the predefined characters in the string.
These predefined characters are:
Period (.)
Back slash (\)
Plus (+)
asterisk (*)
Question mark (?)
square brackets ([])
Caret character (^)
Dollar sign ($)
Parentheses (())
Grammar
Quotemeta (String)
Parameters |
Description |
String |
Necessary. Specifies the string to check. |
Hints and Notes
Tip: This function can be used to escape characters that have special meanings, such as (), [], and * in SQL.
Copy CodeThe code is as follows:
$STR = "Hello World". (Can you hear me?) ";
echo Quotemeta ($STR);
?>
Output:
Hello world\. \ (Can you hear me\?\)
http://www.bkjia.com/PHPjc/323994.html www.bkjia.com true http://www.bkjia.com/PHPjc/323994.html techarticle Copy the code as follows: PHP $zongzi = "ASDFASDF (ASDFASDF?ASFDADSF)"; Echo $zongzi = Quotemeta ($zongzi); echo "BR/"; $zongzi = str Ipslashes ($zongzi); Echo $zongzi;? PHP Quotem ...