0

ホスト名ルートを使用してサブドメインをキャプチャし、カテゴリとして使用しています。次に、コントローラー、アクション、およびキー/値のペアのルータールートをチェーンします。

$hostnameRoute = new Zend_Controller_Router_Route_Hostname(
 ':customer.ddc.:domain',
 array(
  'customer' => ':customer'
 )
);

$routerRoute = new Zend_Controller_Router_Route(
 ':controller/:action/*',
 array(
  'controller' => 'index',
  'action' => 'index'
)
);
$chainedRoute = $hostnameRoute->chain($routerRoute);
$frontController->getRouter()->addRoute('default',$chainedRoute);

URIのキーと値のペアを除くすべてをキャプチャできます。それらを追加すると、リクエスト内のParamsオブジェクトにデータが入力されなくなります。

これは機能します:http: //category.mydomain.com/controller/action/

これはしません:http ://category.mydomain.com/controller/action/username/frank

提案をありがとう。

4

3 に答える 3

1

なしで使用してみてください/*

$routerRoute = new Zend_Controller_Router_Route(
    ':controller/:action',
    array(
        'controller' => 'index',
        'action'     => 'index'
    )
);

12.5.2のように。ルーターの使用について説明します。

于 2010-01-18T15:53:36.343 に答える
1

提案されたパッチは私には機能しませんでした。ZF Webサイトの他の場所にある別のパッチを適用しましたが、うまく機能しているようです:http: //pastie.org/1815135

于 2011-04-20T12:16:05.070 に答える
0

ルートをチェーンするときにワイルドカードの一致を妨げるバグが実際にあります。バグの説明のコメントは、数行のコード変更でこの問題を解決するのに非常に役立ちました。

framework.zend.com/issues/browse/ZF-6654

于 2010-01-18T16:53:50.407 に答える