如何在服务器端语言中获取哈希? [英] How to get hash in a server side language?

查看:21
本文介绍了如何在服务器端语言中获取哈希?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,没有办法在服务器端语言中获取 url 哈希,因为哈希 url 没有被发送到服务器端.我的一位同事告诉我应该可以在 java (jsp) 或 Ruby 中实现.因为我在 PHP 上测试过它,但它根本不起作用.我在谷歌上搜索了 ruby​​ 和 jsp,但没有运气.他还提到第一次访问(http://domain.com/index.php#test )可以从服务器端访问.

As far as I know, there's no way to get url hash in a server side language since hash urls are not being sent to the server side. One of my co-workers told me that it should be possible in java (jsp) or Ruby. Since I tested it on PHP, but it simply doesn't work. I googled about ruby and jsp, but had no luck. He also mentioned that the first access (http://domain.com/index.php#test ) is accessible from a server side.

在 PHP 中,打印我们的 $_SERVER 变量与哈希无关

in PHP, printing our $_SERVER variable doesn't have anything about hash

这在其他服务器端语言中真的可行吗?

Is this really possible in other server side languages?

推荐答案

简短回答:不,这只是客户端的事情.

Short answer: no, it's a client side only thing.

稍长:它被称为片段标识符,并且只是客户端——浏览器不会将那部分 url 发送到服务器.除非您使用某些浏览器实现(或软件),否则它在任何语言中都是不可能的, 会将 url 的那部分发送到服务器.参考:http://en.wikipedia.org/wiki/Fragment_identifier

Slightly longer: It's called Fragment identifier and is client side only - browser doesn't send that part of the url to the server. It's not possible in any language unless you are using some browser implementation (or software) which would send that part of url to the server. Reference: http://en.wikipedia.org/wiki/Fragment_identifier

这篇关于如何在服务器端语言中获取哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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