小白教程
所有教程
关于
Search
172.70.127.98
172.70.127.98
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Func string quotemeta”的源代码
本页内容
上一节:
Func_string_quoted_printable_encode
下一节:
Func_string_rtrim
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:quotemeta()}}[[Category:PHP字符串函数参考手册|43]] = PHP quotemeta() 函数 = [[:分类:PHP字符串函数参考手册]] 在预定义的字符前添加反斜杠: <sample title="" desc="" lang="php" hererun="1"> <?php $str = "Hello world. (can you hear me?)"; echo quotemeta($str); ?> </sample> == 定义和用法 == quotemeta() 函数在字符串中某些预定义的字符前添加反斜杠。 预定义的字符: * 句号(.) * 反斜杠(\) * 加号(+) * 星号(*) * 问号(?) * 方括号([]) * 脱字号(^) * 美元符号($) * 圆括号(()) '''提示:'''该函数可用于转义拥有特殊意义的字符,比如 SQL 中的 ( )、[ ] 以及 * 。 '''注释:'''该函数是二进制安全的。 == 语法 == <pre> quotemeta(string) </pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | string | 必需。规定要检查的字符串。 |} == 技术细节 == {| class="table table-striped table-hover" | 返回值: | 返回引用元字符的字符串。 |- | PHP 版本: | 4+ |} == 更多实例 == == 实例 1 == 在多个预定义的字符前添加反斜杠: <sample title="" desc="" lang="php" hererun="1"> <?php $str1 = "1 + 1 = 2"; $str2 = "1 * 1 = 1"; $str3 = "Could you borrow me 5$?"; $str4 = "Are you not entertained? (I am..)"; $str5 = "The caret [ ^ ] Looks like a hat!"; echo quotemeta($str1)."<br>"; echo quotemeta($str2)."<br>"; echo quotemeta($str3)."<br>"; echo quotemeta($str4)."<br>"; echo quotemeta($str5)."<br>"; ?> </sample> [[:分类:PHP字符串函数参考手册]]
返回至“
Func string quotemeta
”。
上一节:
Func_string_quoted_printable_encode
下一节:
Func_string_rtrim