Kohana 3:$ _GET显示URI路由(控制器/方法)而不是$ _GET参数

时间:2012-05-10 11:09:50

标签: php kohana kohana-3

我在/ order / test

当我尝试/命令/测试时?lala = test& baba = test

public function action_test(){
echo var_dump($_GET);
}

它应该在var_dump()中输出lala = test& baba = test,但是它给了我:

array(1) { ["order/test"]=> string(0) "" }

为什么会这样?我该如何解决这个问题?

这是我的htaccess:

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [F,L]

# Allow any files or directories that exist to be displayed directly
RewriteCond ${REQUEST_URI} ^.+$
RewriteCond %{REQUEST_FILENAME} \.(gif|jpe?g|png|pdf)$ [OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^ - [L]

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php?$0 [PT,L]

2 个答案:

答案 0 :(得分:1)

这就是我原来的.htaccess:

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

也不要使用$ _GET,而是

$this->request->query()

代替HMVC应用程序。

答案 1 :(得分:0)

将重写规则更改为

RewriteRule .* index.php?$0 [PT,L,QSA]