1

このタイプの URL のルートを書きたい

http://www.example.com/category/sub-category/id.html

ここでカテゴリは動的です。つまり、データベースには 100 のカテゴリがあります。サブカテゴリも動的です。ID値に基づいてページを表示する必要があります。誰か提案してください。

4

1 に答える 1

4

最初にドキュメントを読んでみてください。非常に簡単です。

'sample' => array(
                'type' => 'Segment',
                'options' => array(
                    'route' => '/:category[/:sub_category[/:id]].html',
                    'defaults' => array(
                        'controller' => 'Your Controller',
                        'action' => 'Your Action',
                    ),
                ),
            ),

このルーター構成を使用すると、次のことができます。

http://www.example.com/category.html
http://www.example.com/category/sub-category.html
http://www.example.com/category/sub-category/id.html
于 2013-05-12T07:12:23.533 に答える