Php 删除空格后奇怪的换行符
我使用cURL获取站点的内容。我想删除字符串中的所有空格和换行符。这就是我正在做的:Php 删除空格后奇怪的换行符,php,regex,curl,Php,Regex,Curl,我使用cURL获取站点的内容。我想删除字符串中的所有空格和换行符。这就是我正在做的: // Getting the content $curl_handle = curl_init(); curl_setopt($curl_handle, CURLOPT_URL, $url); curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true); $content = curl_exec($curl_handle); curl_close($curl_
// Getting the content
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, $url);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);
$content = curl_exec($curl_handle);
curl_close($curl_handle);
// Removing html tags
$content = strip_tags($content);
// Removing whitespaces
$content = preg_replace('/\s+/', '', $content);
当我回显内容时,只有在以下特殊字符之后才会换行:=),.?}
我已尝试使用str\u replace(数组(“\r\n”、“\r”)、“\n”、$content)删除换行符代码>但它不起作用。
有什么想法吗?告诉我,你真的想删除所有空白,而不仅仅是压缩重复的空白吗?压缩重复的空白是什么意思?