addslashes();
stripslashes(); //對資料庫教程操作時,轉義特殊字元
定義:addslashes() 函式在指定的預定義字元前新增反斜槓。
語法:addslashes(string)
chop(); //除去字串右邊空格
trim(); //除去字串中所有空格
ltrim(); //除去字串左邊空格
htmlspecialchars(); //轉換'$','"','<','>'為相應的html實體
htmlentities(); //轉換所有html標記為相應的html實體
array explode(string separator, string str); //分割字串
string implode(string separator, array arr); //連線字串
strtoupper(); strtolower(); //轉換大小寫
ucfirst(); //只轉換第乙個字元為大寫
ucwords(); //轉換每個words的第乙個字母為大寫
iconv()
php內碼轉換函式,同上
因為iconv()在轉換gb2312時的bug,所以要這樣處理
iconv( "utf-8", "gb2312//ignore" , $str)
mb_convert_encoding()
php的內碼轉換函式
版本(php 4 >= 4.0.6, php 5)
這個函式可以將各種編碼互相轉換
mb_convert_encoding($str,"gb2312", "utf-8");
real_escape_string()
定義:函式轉義 sql 語句中使用的字串中的特殊字元。
語法: mysql_real_escape_string(string,connection)
說明:本函式將 string 中的特殊字元轉義,並考慮到連線的當前字符集,因此可以安全用於 mysql_query()。
?>
php敏感字串過濾 PHP實現敏感詞過濾
1 敏感詞過濾方法 todo 敏感詞過濾,返回結果 param array list 定義敏感詞一維陣列 param string string 要過濾的內容 return string log 處理結果 function sensitive list,string if count 0 else ...
字串過濾
這個我這裡自己一直用的幾個函式,下面貼出來。希望盡量不是直接要例項就去用,而不關心他本來的意義和實現思路等。加油!using system using system.collections.generic using system.text using system.text.regularexpr...
swift 過濾字串 Swift 字串
swift 字串 swift 字串是一系列字元的集合。例如 hello,world 這樣的有序的字元型別的值的集合,它的資料型別為 string。建立字串 你可以通過使用字串字面量或 string 類的例項來建立乙個字串 import cocoa 使用字串字面量 var stringa hello,...