php - yii要配置出这样一个url,需要怎么定义路由规则?
巴扎黑
巴扎黑 2017-04-10 15:00:24
0
1
280

我现在想要配置出这样一个url,需要怎么定义路由规则?
news/<alias>/list-<page>.html
<alias>代表唯一的分类别名。
<page>代表分页的页码。
现在做了这样的配置:

'rules'=>array(
    'index'=>'site/index',
    'all' =>'house/base/index',
    'news/<alias:\w+>/index'=>'news/list',
    'news/list/<alias:\w+>-<page:\d+>'=>'news/list',
    #'news/<alias:\w+>/page/<page:\d+>'=>'news/list',
    #'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
    #'<controller:\w+>/<action:\w+>'=>'>controller>/<action>',
),
巴扎黑
巴扎黑

répondre à tous(1)
巴扎黑
'/news/<alias:\w+>/list-<page:\d+>'=>'/news/list'
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!