Heim > Backend-Entwicklung > PHP-Tutorial > yii要配置出这样一个url,需要怎么定义路由规则?

yii要配置出这样一个url,需要怎么定义路由规则?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-06 20:42:52
Original
973 Leute haben es durchsucht

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

'rules'=>array(
    'index'=>'site/index',
    'all' =>'house/base/index',
    'news/<alias:>/index'=>'news/list',
    'news/list/<alias:>-<page:>'=>'news/list',
    #'news/<alias:>/page/<page:>'=>'news/list',
    #'<controller:>/<action:>/<id:>'=>'<controller>/<action>',
    #'<controller:>/<action:>'=>'>controller>/<action>',
),
</action></action:></controller:></action></controller></id:></action:></controller:></page:></alias:></page:></alias:></alias:>
Nach dem Login kopieren
Nach dem Login kopieren

回复内容:

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

'rules'=>array(
    'index'=>'site/index',
    'all' =>'house/base/index',
    'news/<alias:>/index'=>'news/list',
    'news/list/<alias:>-<page:>'=>'news/list',
    #'news/<alias:>/page/<page:>'=>'news/list',
    #'<controller:>/<action:>/<id:>'=>'<controller>/<action>',
    #'<controller:>/<action:>'=>'>controller>/<action>',
),
</action></action:></controller:></action></controller></id:></action:></controller:></page:></alias:></page:></alias:></alias:>
Nach dem Login kopieren
Nach dem Login kopieren

'/news/<alias:\w+>/list-<page:\d+>'=>'/news/list'
Nach dem Login kopieren

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
PHP-Datenerfassung?
Aus 1970-01-01 08:00:00
0
0
0
PHP-Erweiterung intl
Aus 1970-01-01 08:00:00
0
0
0
Wie man PHP gut lernt
Aus 1970-01-01 08:00:00
0
0
0
Mehrere PHP-Versionen
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage