A-A+
PHP去除头尾空格(包括去除全角空格)
使用php中内置函数trim只能去除半角的空格,无法去除全角空格。在网页中汉字全角空格会被解析为 
<?php
/* 字体转换
$content 内容
$to_encoding 目标编码,默认为UTF-8
$from_encoding 源编码,默认为UTF-8
*/
function mbStrreplace($content,$to_encoding="UTF-8",$from_encoding="UTF-8") {
$content=mb_convert_encoding($content,$to_encoding,$from_encoding);
$str=mb_convert_encoding(" ",$to_encoding,$from_encoding);
$content=mb_eregi_replace($str," ",$content);
$content=mb_convert_encoding($content,$from_encoding,$to_encoding);
$content=trim($content);
return $content;
}
?>
来学习了。。。