<small id='THD9k'></small><noframes id='THD9k'>

        <bdo id='THD9k'></bdo><ul id='THD9k'></ul>
      <tfoot id='THD9k'></tfoot>

        <legend id='THD9k'><style id='THD9k'><dir id='THD9k'><q id='THD9k'></q></dir></style></legend>
      1. <i id='THD9k'><tr id='THD9k'><dt id='THD9k'><q id='THD9k'><span id='THD9k'><b id='THD9k'><form id='THD9k'><ins id='THD9k'></ins><ul id='THD9k'></ul><sub id='THD9k'></sub></form><legend id='THD9k'></legend><bdo id='THD9k'><pre id='THD9k'><center id='THD9k'></center></pre></bdo></b><th id='THD9k'></th></span></q></dt></tr></i><div id='THD9k'><tfoot id='THD9k'></tfoot><dl id='THD9k'><fieldset id='THD9k'></fieldset></dl></div>

        在 URL 中使用双斜杠有什么缺点吗?

        时间:2023-09-23

            <small id='qOWDw'></small><noframes id='qOWDw'>

              <bdo id='qOWDw'></bdo><ul id='qOWDw'></ul>
                  <tbody id='qOWDw'></tbody>
                <i id='qOWDw'><tr id='qOWDw'><dt id='qOWDw'><q id='qOWDw'><span id='qOWDw'><b id='qOWDw'><form id='qOWDw'><ins id='qOWDw'></ins><ul id='qOWDw'></ul><sub id='qOWDw'></sub></form><legend id='qOWDw'></legend><bdo id='qOWDw'><pre id='qOWDw'><center id='qOWDw'></center></pre></bdo></b><th id='qOWDw'></th></span></q></dt></tr></i><div id='qOWDw'><tfoot id='qOWDw'></tfoot><dl id='qOWDw'><fieldset id='qOWDw'></fieldset></dl></div>

                  <tfoot id='qOWDw'></tfoot>

                  <legend id='qOWDw'><style id='qOWDw'><dir id='qOWDw'><q id='qOWDw'></q></dir></style></legend>
                1. 本文介绍了在 URL 中使用双斜杠有什么缺点吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我用 PHP 编写了自己的 MVC 框架,它使用以下格式的 url:

                  I've written my own MVC framework in PHP, which uses urls in the format of:

                  /controller/method/param1/param2/param...

                  我这样做是为了可以忽略默认"方法(默认情况下index()),所以这会导致像 /controller//param1/param2/param 这样的 URL....例如,一个 URL:/view//panel-glide/3 将在 view 中调用 index('panel-glide', 3)代码>控制器.

                  I've made it so that "default" methods can be ignored (by default index()), so this results in URLs like /controller//param1/param2/param.... For example, a URL of: /view//panel-glide/3 will call index('panel-glide', 3) in the view controller.

                  这很好用,但我担心搜索引擎或一些较旧的浏览器在看到双斜杠时可能会吓坏了,因为我认为我以前似乎从未使用过它们.

                  This works fine and dandy, but I'm concerned that search engines or some older browsers might freak out when they see the double slashes, as I don't think I've actually seem them ever be used before.

                  有没有人知道我在使用它时可能遇到的任何问题?

                  Is anyone aware of any issues I might come across by using this?

                  推荐答案

                  WebMasters 上已有一个答案讨论了 两个斜线.Apache 讨论的比较多,但是思路应该是通用的.

                  There is an existing answer on WebMasters that discusses the dangers of having two slashes. It discusses Apache a lot, but the ideas should be applicable generally.

                  本质上,我认为不推荐./foo/bar/foo//bar 真的应该是两条完全不同的路径.每一条斜线都很重要,试图规避标准化的尝试肯定会反过来咬你.

                  In essence, I don't think it is recommended. /foo/bar and /foo//bar really should be two completely different paths. Each slash is significant, and attempts at circumventing that standardization are bound to come back to bite you.

                  正如答案中提到的,相对路径失败也存在非常真实的危险.一些浏览器会正确计算出来自 /foo/bar//baz 的相对路径 ../../fizz/foo/bar/fizz,而其他人会将双斜线视为单斜线,并选择 /foo/fizz.

                  As is mentioned in the answer, there's also a very real danger of relative paths failing. Some browsers will correctly figure that a relative path ../../fizz from /foo/bar//baz is /foo/bar/fizz, while others will treat the double slash as a single one, and opt for /foo/fizz.

                  另外,我觉得它看起来很有趣.

                  Plus, I think it looks funny.

                  这篇关于在 URL 中使用双斜杠有什么缺点吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:PHP 的 $_GET 和 URL 重写 下一篇:从 iis7 中的 wordpress URL 中删除 index.php

                  相关文章

                  <i id='yHsnx'><tr id='yHsnx'><dt id='yHsnx'><q id='yHsnx'><span id='yHsnx'><b id='yHsnx'><form id='yHsnx'><ins id='yHsnx'></ins><ul id='yHsnx'></ul><sub id='yHsnx'></sub></form><legend id='yHsnx'></legend><bdo id='yHsnx'><pre id='yHsnx'><center id='yHsnx'></center></pre></bdo></b><th id='yHsnx'></th></span></q></dt></tr></i><div id='yHsnx'><tfoot id='yHsnx'></tfoot><dl id='yHsnx'><fieldset id='yHsnx'></fieldset></dl></div>

                  <tfoot id='yHsnx'></tfoot>

                  <small id='yHsnx'></small><noframes id='yHsnx'>

                    <bdo id='yHsnx'></bdo><ul id='yHsnx'></ul>
                  1. <legend id='yHsnx'><style id='yHsnx'><dir id='yHsnx'><q id='yHsnx'></q></dir></style></legend>