PHP addcslashes() 函數(shù)
PHP addcslashes() 函數(shù)用于在 C 風(fēng)格中添加帶有轉(zhuǎn)義字符的引號(hào)字符串。愛掏網(wǎng) - it200.com它是大小寫敏感的。愛掏網(wǎng) - it200.com
string addcslashes ( string str , stringcharlist )
參數(shù) | 描述 | 必需/可選 |
---|---|---|
字符串 | 需要轉(zhuǎn)義的字符串 | 必需 |
字符 | 需要轉(zhuǎn)義的字符或范圍 | 必需 |
示例1
<?php
str="Welcome to JavaTpoint";
echo "Your String : ".str;
echo "<br>"."By using 'addcslashes()' method your string: ".addcslashes($str,'T')."<br>";
?>
輸出:
Your String : Welcome to JavaTpoint
By using 'addcslashes()' method your string: Welcome to Java\Tpoint
示例2
<?php
str="Welcome to JavaTpoint";
echo "Your String : ".str;
echo "<br>"."By using 'addcslashes()' method your string: ".addcslashes($str,'a')."<br>";
?>
輸出:
Your String : Welcome to JavaTpoint
By using 'addcslashes()' method your string: Welcome to J\av\aTpoint
示例3
<?php
str ="Welcome to JavaTpoint"."<br>";
echo "str";
echo addcslashes($str,'A..Z')."<br>";
?>
輸出:
Welcome to JavaTpoint
\Welcome to \Java\Tpoint
示例4
<?php
str ="Welcome to JavaTpoint"."<br>";
echo "str";
echo addcslashes($str,'a..z')."<br>";
?>
輸出:
Welcome to JavaTpint
W\e\l\c\o\m\e \t\o J\a\v\aT\p\o\i\n\t<\b\r>
示例5
<?php
str ="Welcome to JavaTpoint";
echo "Your string value is: ".str."<br>";
echo "By using addcslashes() Function your value is : ".addcslashes($str,'a..m');
?>
輸出:
Your string value is: Welcome to JavaTpoint
By using addcslashes() Function your value is : W\e\l\co\m\e to J\av\aTp\oint
聲明:所有內(nèi)容來自互聯(lián)網(wǎng)搜索結(jié)果,不保證100%準(zhǔn)確性,僅供參考。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進(jìn)行處理。