使用PHP / Symfony在URL中获得#part [英] Get #part in URL with PHP/Symfony

查看:102
本文介绍了使用PHP / Symfony在URL中获得#part的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Symfony 1.2。我有一个带有对象列表的视图。我可以订购它们,按类别过滤它们,或移到下一页(有分页)。一切都用AJAX完成,因此我不必再次加载所有页面。

I'm working with Symfony 1.2. I've a view with a list of objects. I can order them, filter them by category, or moving to the next page (there is pagination). Everything is done with AJAX, so I don't have to load all the page again.

我想要实现的是拥有 http:// urltopage#page = 1& order = title& cats = 1,2 ;因此新页面将保存在浏览器的历史记录中,他可以将其粘贴到另一个网站上。

What I want to achieve is to have http://urltopage#page=1&order=title&cats=1,2 for example; so the new page is saved in the browser history, and he can paste it to another web.

我还没有找到获取#part的方法。我知道这仅适用于浏览器,但我无法相信我无法通过PHP。我确定有一个简单的解决方案我会丢失...

I haven't found a way to get the #part. I know that's only for the browser but I can't believe I can't get through PHP. I'm sure there is a simple solution I'm missing...

非常感谢!

推荐答案

您无法通过PHP来获取它,因为它从未传输到服务器。

You can't get it through PHP because it's never transmitted to the server.

不过,您可以使用JavaScript来获取它通过 window.location.hash ,然后通过AJAX将其传输到服务器。

You can, however, get it with JavaScript via window.location.hash, then transmit it to the server via AJAX.

这篇关于使用PHP / Symfony在URL中获得#part的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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