2011-12-23 48 views
4

我正在嘗試使用cakephp的重定向控制器函數重定向包含hashtag(#)的url。cakephp 2使用標籤重定向url

當我使用此代碼它的URL編碼包括hashtag

$this->redirect(array('action' => 'index',$menuItem."#article_id_".$created_id)); 

output: http://something.com/link%23article_id_62 

有沒有一種方式,

回答

10

您需要使用#鍵:

$this->redirect([ 
    // ... 
    '#' => 'article_id_' . $created_id, 
]); 
+1

是的!而已!謝謝! – waterschaats 2011-12-23 12:36:48

+1

哈!好的CakePHP。這是一個挽救生命的事情,讓我發瘋。 – 2013-02-05 16:41:12