【问题标题】:GET query style arguments from hash bang URL从 hash bang URL 获取查询样式参数
【发布时间】:2016-01-18 03:18:27
【问题描述】:

我有这个 Url 使用 hash bang 方法:

mydomain/gallery/view/246/gallery-title/#!/page=2&order=desc 

重写网址:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(gallery)/(.*)/([0-9]+)/(.*)$ index.php?page=$1&type=$2&id=$3&title=$4&lang=en [NC,L,QSA]

不,我需要 GET 页码 (i.e:2) 并从 url 订购 (desc) 值。如何获得这个值?

【问题讨论】:

  • hash bang 被客户端处理。
  • @chris85: 当然可以,但我认为可以使用客户端方法 (javascript) 或 Php Parse_url
  • 你不能在它上面使用任何 PHP 函数,它永远不会到达服务器。 stackoverflow.com/a/3951093/4333555

标签: javascript php .htaccess mod-rewrite hash


【解决方案1】:

这是行不通的,因为 hashbang 从未发送到服务器,您可以通过查看日志来确认这一点。

作为一种解决方法,例如可以使用 URI.js 将 hashbang 更改为普通查询参数,以便它们在服务器上可用。

【讨论】:

    猜你喜欢
    • 2014-05-17
    • 2018-12-10
    • 2018-05-29
    • 1970-01-01
    • 1970-01-01
    • 2017-02-01
    • 2011-03-24
    • 2020-09-12
    • 1970-01-01
    相关资源
    最近更新 更多