很多时候,我们在做优化处理的时候,会考虑压缩HTML,去掉HTML里面的空格和换行。

具体实现:

public function change(){
    echo "change";
    $url = "http://sanqi.e0yu.com/";
    $file = file_get_contents($url);
    $file = preg_replace("/\t/","",$file);//将空格 替换为空
    $file = preg_replace("/\r\n/","",$file);// 将换行 替换为空
    echo $file;
}

 

相关文章:

  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2023-01-29
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-01
  • 2022-01-13
  • 2021-09-10
  • 2021-11-24
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案