1

Zend Framework は初めてです。次のようなページがあります。

http://localhost/demo/public/index/index/catid/art

私はそれをに変えたい

http://localhost/demo/public/art

やり方がわかりません。

また、なぜindex2回入れるのですか?私のページネーションでさえ、次のようにそれを持っています:

http://localhost/demo/public/index/index/page/2

私の意見では、少し面倒です。ページネーションをしてほしい

http://localhost/demo/public/page/2

それを行う方法はありますか?ありがとう!

4

1 に答える 1

2

デフォルトルートは、以下を使用して機能します。

/module/controller/action

したがって、「default」というモジュール、「index」というコントローラー、および「index」というアクションがある場合、その特定のアクションを参照する最も詳細な方法は次のようになります。

/module/controller/action

ルートを設定するには、次を使用します。

$route = new Zend_Controller_Router_Route(
           'page/:page',
           array(
              'module' => 'default'
              'controller' => 'index',
              'action' => 'index'
            ),
            array(
               'page' => '\d+'
             )
          );

次に、を使用してコントローラーでページパラメーターを取得できます。

$this->getRequest->getParam("page");

于 2012-10-25T17:31:38.763 に答える