为什么某些 PHP 或 JS 文件上传为一行而不是保持格式?

发布于 2024-11-28 21:19:16 字数 233 浏览 3 评论 0原文

我提供用 JS、PHP 和 CSS 文件编写的插件的 zip 文件,供用户上传到他们的服务器。然而,在某些用户情况下,JS 文件会作为一行上传,显然会导致大量失败并引起用户投诉。为了让它再次工作,我只需打开文件并将我格式正确的版本复制/粘贴到他们的版本上。急!那么,有人可以解释一下这里出了什么问题以及如何防止这个易于修复但耗时的问题吗?我在 Win 上使用 Notepad++,是否应该使用某种设置来保存我的文件?或者这是我无法阻止的远程服务器问题?

I am offering zip files of a plugin I wrote with JS, PHP and CSS files for the user to upload to their server. However, in some user cases the JS file gets uploaded as one line, obviously causing a massive FAIL and a complaint from users. To get it working again, I just open the file and copy/paste from my properly formatted version onto theirs. Presto! So, can someone explain what is going wrong here and how I can prevent this easy-to-fix but time consuming problem? I am using Notepad++ on Win, is there some kind of setting I should be using to save my files? Or is it a remote server problem that I just can't prevent?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我ぃ本無心為│何有愛 2024-12-05 21:19:16

这很可能是由不同的行结尾及其在不同操作系统上的解释引起的。我本以为这些问题现在已经结束了,但显然还没有。

向您的客户询问在目标系统上创建的任何文件,并查看那里本地使用的行结尾。然后只需为他们提供目标平台的文件(AFAIR Notepadd++ 允许您使用任何 EOL 保存文件)。

Most likely this is caused by different line endings and their interpretations on various operating systems. I would thought that nowadays these problems are over, apparently not.

Ask your customer for any file created on the target system and see what line ending is natively used there. Then simply give them file for the target platform (AFAIR Notepadd++ allows you to save file in with any EOL).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文