是否有兼容的方法来编写href?

omg*_*omg 1 html anchor href

例如,在文件中test.php:

<a href="someting/?start=1">go</a>;
Run Code Online (Sandbox Code Playgroud)

所以无论在何处test.php,无论是在Document_Root/Test/目录中还是在Document_Root/Production/目录中,锚都将指向自身.

Pau*_*her 10

要编写仅更改查询字符串的链接,只需使用

<a href="?foo=bar">whatever</a>
Run Code Online (Sandbox Code Playgroud)

所以如果你在http://the/current/url.php,它会去http://the/current/url.php?foo=bar,或者如果你在http://somewhere/else?entire=ly,它会去http://somewhere/else?foo=bar.

  • 如果是,请点击左侧的支票接受他的回答 (3认同)