简体   繁体   English

在文件名中使用多个点 (.)

[英]Using multiple dots (.) in file names

Are there reasons not to use multiple .是否有理由不使用多个. in website file names (images, css files, js files...) like in logo.french.png ?在网站文件名(图像、css 文件、js 文件...)中,如logo.french.png

Too bad that answers cannot be so short: No.太糟糕了,答案不能这么短:不。

Update:更新:

Mmh ok let me think (you wanted that!):嗯好吧让我想想(你想要那个!):

  • URLs don't restrict the uses of periods in the path. URL 不限制路径中句点的使用。
  • The normal file naming restrictions of the OS your server is running on apply.运行服务器的操作系统的正常文件命名限制适用。
    If you run Linux or UNIX then you should be pretty free in naming your files (regarding periods).如果您运行 Linux 或 UNIX,那么您应该可以很自由地命名您的文件(关于句点)。 Windows, not so sure ;) Windows,不太确定;)

Update 2:更新 2:

There might be some special configurations of your web server (like Apache's content negotiation ) that also uses several periods in the filename to distinguish content.您的 Web 服务器可能有一些特殊配置(如Apache 的内容协商),它们也在文件名中使用多个句点来区分内容。 But that should not interfere with naming your files this way.但这不应该以这种方式命名您的文件。

No.没有。

The only reason I can think of to not use multiple .我能想到的不使用多个. 's in a filename is that a very poorly written file-extension checker might get confused.文件名中的 's 是编写非常糟糕的文件扩展名检查器可能会感到困惑。

Yes.是的。

I had a file on my website named ads.atx.ps.960.jpg, referenced inside an img src tag... that spot came up blank in both Chromium and Firefox on Linux when I retrieved the page.我的网站上有一个名为 ads.atx.ps.960.jpg 的文件,在 img src 标签中引用了……当我检索该页面时,该位置在 Linux 上的 Chromium 和 Firefox 中都是空白的。 When I finally out of desperation changed the name to ads_atx_ps_960.jpg, it worked fine.当我最终出于绝望将名称更改为 ads_atx_ps_960.jpg 时,它运行良好。

I don't know if the problem was with the browser or the web server, just know it didn't work with the dots, in either browser.我不知道问题出在浏览器还是网络服务器上,只知道它在任何一种浏览器中都无法与点一起使用。 My query for the server type returned "Apache/2"我对服务器类型的查询返回了“Apache/2”

Note that I do also have a bunch of html files with multiple dots in the names, things like yocto.file.copy.html, etc... these are referenced in href tags and all work fine, the first time I saw the problem was with the JPG in an img src tag.请注意,我确实也有一堆名称中带有多个点的 html 文件,例如 yocto.file.copy.html 等……这些在 href 标签中被引用并且一切正常,这是我第一次看到问题与 img src 标签中的 JPG 一起使用。

We do use webpack.config.js file name in our javascript projects to configure webpack.我们确实在我们的 javascript 项目中使用webpack.config.js文件名来配置 webpack。 So, it is not a general scenario.因此,这不是一般情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM