从CodeIgniter中的URL捕获散列(#) [英] Capturing hash(#) from URL in CodeIgniter

查看:120
本文介绍了从CodeIgniter中的URL捕获散列(#)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似


mysite.com/transactions/view/123456

mysite.com/transactions/view/123456

这很好。

但是我的客户现在希望在url

however my client now wishes to have a hashbang in the url


mysite.com/transactions/view/ 123456

现在显而易见的问题是浏览器将hashbang当作锚指令。

Now the obvious issue here is that browsers treat the hashbang as an anchor directive.

有没有反对的代码igniter允许hashbang和#123456(或者只是123456)传递给视图函数?

Is there anyway to in code igniter allow the hashbang and have #123456 (or even just 123456) passed to the view function?

推荐答案


在代码点火器
允许hashbang和#123456
(或甚至只是123456)传递到
视图函数?

Is there anyway to in code igniter allow the hashbang and have #123456 (or even just 123456) passed to the view function?

缺少javascript,没有。浏览器根本不会将URL的fragment部分发送到服务器。 PHP只能读取它,如果JavaScript运行后页面已渲染发送它在第二个请求。

Short of javascript, no. The browser simply doesn't send the 'fragment' portion of the URL to the server. PHP can only read it if javascript running after the page has rendered sends it in a second request.

这篇关于从CodeIgniter中的URL捕获散列(#)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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