如何将长文本压缩以便在JavaScript中高效输出?
- 内容介绍
- 文章标签
- 相关推荐
本文共计70个文字,预计阅读时间需要1分钟。
javascriptfunction jsFormat($str) { $str=str_replace('\\', '\\\\\\', $str); $str=str_replace(chr(10), '', $str); $str=str_replace(chr(13), '', $str); $str=str_replace(' ', '', $str); $str=str_replace('\'', '“', $str);}
function jsFormat($str) { $str = str_replace('\\s\\s', '\\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; }
本文共计70个文字,预计阅读时间需要1分钟。
javascriptfunction jsFormat($str) { $str=str_replace('\\', '\\\\\\', $str); $str=str_replace(chr(10), '', $str); $str=str_replace(chr(13), '', $str); $str=str_replace(' ', '', $str); $str=str_replace('\'', '“', $str);}
function jsFormat($str) { $str = str_replace('\\s\\s', '\\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; }

