This blog summarizes a plenty of programming tricks coming from Allen's practical project experiences, including PHP, C#, Java, Yii Framework, Lucene...
Tuesday, 3 April 2012
PHP Remove Incorrect encoding characters, TAB, Enter, HTML...
function dataCleasing($data){
$data = strip_tags ($data); // remove HTML Tags
// remove Incorrect encoding characters
$data = preg_replace ( '/[^(\x20-\x7F)]*/', "", $data );
$data = str_replace ( "\n", "", $data );//remove Enter
$data = str_replace ( ",", "", $data );//remove Comma
$data = str_replace ( "\t", "", $data );//remove TAB
$data = str_replace ( "\r\n", "", $data );//remove Enter
$data = trim($data);
return $data;
}
帮自己宣传一下刚上线的网站 梦奇网;目前的提供的服务是 签证搜索 和 时间和日期。谢谢大家支持,SEO下!
Subscribe to:
Post Comments (Atom)
thanks, the very nice blog help the programming tricks good information
ReplyDelete