我正在使用以下代码删除 html 中的空格。我只想删除标签之间的空格。但是下面的代码替换了所有空格
I.E 删除“>”和“<”之间的所有空格
//read the entire string
$str=file_get_contents('sample.txt');
//replace all white spaces
$str=str_replace("\n", "",$str);
$str=str_replace("\t", "",$str);
$str=str_replace(" ", "",$str);
//write the entire string
file_put_contents('sample.txt', $str);
最佳答案
关于php - 删除 HTML 中标签之间的空格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36096319/