W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗值獎勵
(PECL ibm_db2 >= 1.6.0)
db2_escape_string — 用于轉(zhuǎn)義某些字符
db2_escape_string(string $string_literal): string
在字符串參數(shù)中將反斜杠預(yù)置到特殊字符。
string_literal
包含需要修改的特殊字符的字符串。 前面加上反斜杠的字符是 、 、 、 、 和 。\x00
\n
\r
\
'
"
\x1a
返回特殊字符 如上所述,前面加上反斜杠。string_literal
示例 #1 A db2_escape_string() example
使用 db2_escape_string() 函數(shù)的結(jié)果
<?php
$conn = db2_connect($database, $user, $password);
if ($conn) {
$str[0] = "All characters: \x00 , \n , \r , \ , ' , \" , \x1a .";
$str[1] = "Backslash (\). Single quote ('). Double quote (\")";
$str[2] = "The NULL character \0 must be quoted as well";
$str[3] = "Intersting characters: \x1a , \x00 .";
$str[4] = "Nothing to quote";
$str[5] = 200676;
$str[6] = "";
foreach( $str as $string ) {
echo "db2_escape_string: " . db2_escape_string($string). "\n";
}
}
?>
以上示例會輸出:
db2_escape_string: All characters: \0 , \n , \r , \\ , \' , \" , \Z . db2_escape_string: Backslash (\\). Single quote (\'). Double quote (\") db2_escape_string: The NULL character \0 must be quoted as well db2_escape_string: Intersting characters: \Z , \0 . db2_escape_string: Nothing to quote db2_escape_string: 200676 db2_escape_string:
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: