PHP stripcslashes 函式基本語法
String stripcslashes( $string )
stripcslashes 函式小括號內的字串 $string 為必填項目,即要轉換的字串,與 stripslashes 函式一樣,都不能指定特殊字元或字符,僅能單純的消去字串中的反斜線(\),無法消去其他的符號。
PHP stripcslashes 函式範例
<?php
$new_string = "Welcome to \wibibi.It was a very nice day.";
echo $new_string.'<br>';
echo stripslashes($new_string);
?>
以上範例輸出結果如$new_string = "Welcome to \wibibi.It was a very nice day.";
echo $new_string.'<br>';
echo stripslashes($new_string);
?>
Welcome to \wibibi.It was a very nice day.
Welcome to wibibi.It was a very nice day.
由此範例可以得知,PHP stripcslashes 函式不只可以用來轉換被 addcslashes 函式處理過的字串,也可以處理原本就含有反斜線的字串,不過通常單純過濾的字串中的反斜線,會採用 stripslashes 函式比較直接,僅管兩者功能類似。Welcome to wibibi.It was a very nice day.
PHP stripcslashes 函式相關主題研究