stripcslashes() 是 PHP 的預定義函數。它用於刪除反斜杠並清理從數據庫或 HTML 表單中檢索到的數據。它返回一個去掉反斜杠的字符串。
當我們需要刪除反斜杠時,這個函數 stripcslashes() 很重要。
用法:
string stripcslashes ( string $str );
參數 | 描述 | 必需/可選 |
---|---|---|
String | 用於指定要檢查的字符串 | required |
例子1
<?php
$str="Hello PHP!";
echo "Your String is:".$str;
echo "<br>";
echo "By using stripcslashes() Function".stripcslashes($str);
?>
輸出:
Hello PHP!
例子2
<?php
$string="Hello, we areLearning PHP from javaTpoint.";
echo "Before using 'stripcslashes()' Function:".$string;
echo "<br>";
echo "By using 'stripcslashes()' Function:".stripcslashes($string);
?>
輸出:
Before using 'stripcslashes()' Function:Hello, we areLearning PHP from javaTpoint. By using 'stripcslashes()' Function:Hello, we areLearning PHP from javaTpoint.
參考:
http://php.net/manual/en/function.stripcslashes.php相關用法
- PHP stripslashes()用法及代碼示例
- PHP stripos()用法及代碼示例
- PHP strip_tags()用法及代碼示例
- PHP string rtrim()用法及代碼示例
- PHP string printf()用法及代碼示例
- PHP string ord()用法及代碼示例
- PHP string join()用法及代碼示例
- PHP string sha1()用法及代碼示例
- PHP string setlocale()用法及代碼示例
- PHP string sha1_file()用法及代碼示例
- PHP string md5()用法及代碼示例
- PHP string ltrim()用法及代碼示例
- PHP string str_repeat()用法及代碼示例
- PHP string lcfirst()用法及代碼示例
- PHP string str_shuffle()用法及代碼示例
- PHP string similar_text()用法及代碼示例
- PHP string crypt()用法及代碼示例
- PHP string str_ireplace()用法及代碼示例
- PHP stristr()用法及代碼示例
注:本文由純淨天空篩選整理自 PHP stripcslashes() Function。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。