如何在PHP中使用散列传递参数 [英] How to pass parameters with hash in PHP

查看:94
本文介绍了如何在PHP中使用散列传递参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,当我看到谷歌结果页面,查询和其他参数传递与#(哈希),而不是通常的?



另外,在facebook我看到了同样的事情。这是非常有趣的,经过简单的搜索后,使用 google < a>,我发现了与perl和Ruby相关的结果,但没有使用PHP的结果。



是否可以在PHP中使用#而不是?来传递参数或者只有perl / Ruby才有可能。这将是有用的,搜索引擎不会解析URL中的参数。



任何想法对我都有帮助。传统上,告诉浏览器自动滚动到一个这个页面中的特定点(通常用于实现从页面的一部分(例如目录)到另一部分(例如部分标题)的链接。

然而,它也会导致包含的URL被记录在历史记录中,即使它与之前的URL相同以及它后面的内容。 (换句话说,用户仍然在同一页面上)。这意味着即使状态更改与页面不一致,也可以使用后退按钮返回到之前的状态,现在的AJAX应用程序常常用它来表示发生了某些事情,用户可能想要返回。




Recently when i saw google results page, the query and other parameters where passed with # (hash) instead of the usual "?"

Also, in facebook i saw the same thing. This was quite interesting and after a simple search with google, i found the results related to perl and Ruby but no result with PHP.

Is it possible to pass parameters with # in PHP instead of "?" or is this possible only with perl/Ruby. This will be useful and search engines will not parse the parameters in the URLs.

Any ideas will be helpful to me.

解决方案

Traditionally, the # told the browser to automatically scroll to a particular point in the page, which was (and still is) often used to implement links from one part of a page (e.g. a table of contents) to another (e.g. a section heading).

However, it also has the effect of causing the URL containing the # to be recorded in the history, even if it's identical to the previous URL except for the # and what follows it. (In other words, the user is still on the same page.) This means that the back button can be used to get back to the state that you were previously in, even if that state-change doesn't correspond to a page-load.

Modern AJAX applications therefore often use it to signify that something has happened that the user might want to "go back" from.

这篇关于如何在PHP中使用散列传递参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆