分享一下:
function jsformat($str)
{
$str = trim($str);
$str = str_replace('ss', 's', $str);
$str = str_replace(chr(10), '', $str);
$str = str_replace(chr(13), '', $str);
$str = str_replace(' ', '', $str);
$str = str_replace('', '', $str);
$str = str_replace('"', '"', $str);
$str = str_replace(''', ''', $str);
$str = str_replace("'", "'", $str);
return $str;
}
使用就不用说了,就是直接调用jsformat($str)
function jsformat($str)
{
$str = trim($str);
$str = str_replace('ss', 's', $str);
$str = str_replace(chr(10), '', $str);
$str = str_replace(chr(13), '', $str);
$str = str_replace(' ', '', $str);
$str = str_replace('', '', $str);
$str = str_replace('"', '"', $str);
$str = str_replace(''', ''', $str);
$str = str_replace("'", "'", $str);
return $str;
}
使用就不用说了,就是直接调用jsformat($str)







