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

我现在想要配置出这样一个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>',
),
巴扎黑
巴扎黑

Antworte allen(1)
巴扎黑
'/news/<alias:\w+>/list-<page:\d+>'=>'/news/list'
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!