当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > quotemeta() 函数
The quotemeta() function adds backslashes in front of some predefined characters in a string.
quotemeta()函数的作用是:转义字符串中的meta字符。
The predefined characters are:
与定义字符如下
quotemeta(string) |
Parameter参数 | Description描述 |
---|---|
string | Required. Specifies the string to check 必要参数。指定字符串对象 |
Tip: This function can be used to escape characters with special meanings, such as ( ), [ ], and * in SQL.
提示:这个函数是用来转义字符的,如同SQL中的( )、[ ]和 * 。
<?php $str = "Hello world. (can you hear me?)"; echo quotemeta($str); ?> |
The output of the code above will be:
上述代码将输出下面的结果:
Hello world. (can you hear me?) |