Share it:
Copy the code The code is as follows:
function jsformat($str)
{
$str = trim($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;
}
The above introduces the implementation code of output escape JavaScript code in search engine optimization PHP, including the content of search engine optimization. I hope it will be helpful to friends who are interested in PHP tutorials.