简体   繁体   English

<a href>在链接上隐式地</a>制作(或传递) <a href>php变量</a>

[英]Making (or passing) an <a href> php variable invisibly on a link

Is there a way to put a php variable in an without it automatically being visible, like a GET variable? 有没有一种方法可以将php变量放入一个不自动可见的变量中,例如GET变量?

<a href="myphpfile.php?variable=hidden">Some click</a>

I want the subsequent browser URL to be www.myphpfile.php (no variable visible). 我希望后续的浏览器URL为www.myphpfile.php (无可见变量)。

Thanks for any help. 谢谢你的帮助。

If I understood you right you want to have something like this: 如果我正确理解您的意思,那么您希望拥有以下内容:

  1. Start a session and write the contents of $_GET['location'] into, eg, $_SESSION['location'] . 开始会话并将$_GET['location']的内容写入例如$_SESSION['location']
  2. Redirect the user, eg header('Location: myfile.php'); 重定向用户,例如header('Location: myfile.php');
  3. If the user changes his location, start at 1 如果用户更改了位置,则从1开始

You could create a form for it with method="post" and style the submit button as a normal link using CSS. 您可以使用method="post"为它创建一个表单,然后使用CSS将提交按钮设置为普通链接的样式。

That is if I understood you question correctly. 那是我是否理解您正确的问题。

You should use <a href="fake" onclick="window.location=real"> , but I prefer use links as The Lord W3C has declared originally. 您应该使用<a href="fake" onclick="window.location=real"> ,但是我更喜欢使用 The Lord W3C最初声明的链接。

Edit: 编辑:

<a href="javascript:goto(nice_url_like_thing)">;

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

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