PHP中的addcslashes()函数
The addcslashes() function returns the string with blackslashes.
Note − The addcslashes() function is case-sensitive
Syntax
addcslashes(str, characters)
参数
str − 要转义的字符串
characters − 要转义的字符或字符范围
返回值
addcslashes() 函数返回一个在指定字符前加上反斜杠的字符串。
示例
以下是一个示例 −
实时演示
<?php $str = addcslashes("First World!","W"); echo($str); ?>
输出
以下是输出 −
First \World!
示例
让我们看另一个示例 −
演示
<?php $str = addcslashes("First World!","a..r"); echo($str); ?>
输出
以下是输出 −
F\i\rst W\o\r\l\d!
以上就是PHP中的addcslashes()函数的详细内容,更多请关注其它相关文章!