如何删除不需要的“额外换行符"解压后出现在 PHP/CSS/JS 文件中? [英] How to remove unwanted "extra line breaks" that appear in PHP/CSS/JS files after unzip?

查看:25
本文介绍了如何删除不需要的“额外换行符"解压后出现在 PHP/CSS/JS 文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下事项:

  • 压缩一个文件夹,上传到服务器
  • 使用unzip archive.zip"在服务器上解压缩
  • 从该文件夹下载任何 PHP 文件
  • 多余的换行符出现在不需要的地方

任何想法为什么会发生这种情况或如何撤消它"?我试图做一个查找和替换",但最终基本上将整个文件缩小到1 行",这也是不想要的......

Any ideas why this happens or how to "undo it"? I have tried to do a "find and replace" but that ends up basically minifying the entire file onto "1 line", which is not wanted either...

在此处检查附加的图像

推荐答案

为了后人:我发现我可以使用这个策略:https://pixelflips.com/blog/removing-line-breaks-in-织梦者

For the sake of posterity: I found that I was able to use this tactic: https://pixelflips.com/blog/removing-line-breaks-in-dreamweaver

  • 打开查找/替换框 (CMD+F/CTRL+F)
  • 在 Find 中输入:[\r\n]{2,}
  • 在替换中输入:\n
  • 选中使用正则表达式"框并取消选中任何其他框.
  • 点击全部替换"

通过使用 Adob​​e Dreamweaver,它可以工作...

By using Adobe Dreamweaver, which works...

但是,我不会让我自己的答案正确,因为我仍然想知道为什么会发生这种情况,并希望在可能的情况下防止它发生.

However, I am not going to make my own answer correct as I still wonder why this happens and want to prevent it if possible.

这篇关于如何删除不需要的“额外换行符"解压后出现在 PHP/CSS/JS 文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆