私はzendframeworkのルートとパラメータに問題があります。ルートとURLパラメータ - ZendFramework
私は私のビューページで言語セレクタを持っている:
<div class="language-chooser">
<?
$params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
unset($params['module']);
unset($params['controller']);
unset($params['action']);
?>
<a href="<?= $this->url(array_merge($params, array('lang' => 'pt'))); ?>"><img src="<?= $this->baseUrl('/images/flags/br.png'); ?>" alt="" /></a>
<a href="<?= $this->url(array_merge($params, array('lang' => 'en'))); ?>"><img src="<?= $this->baseUrl('/images/flags/us.png'); ?>" alt="" /> </a>
</div>
それはルートなしで正常に動作します。 localhostの/アプリ/連絡先へのアクセス、私はリンクを取得正しく例:localhostの/アプリ/連絡先/インデックス/ LANG/
エンしかし、私はルートを追加する場合
protected function _initRotas() {
$router = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route(
'/contact',
array(
'module' => 'default',
'controller' => 'contact',
'action' => 'index'
)
);
$router->addRoute('contact', $route);
}
は私がLANGのないリンクを取得param。例:localhost/app/contact/
どうすればこの問題を解決できますか?最初の例では、ルートの最後に:module/:controller/:action/*
お知らせ*
のように見えるデフォルトルートに基づいており、
おかげ
は、このHTTPを読む:// stackoverflow.com/questions/8345018/zend-reverse-matching-of-ro utes-returns-current-url/ – emaillenin