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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:42:52
Original
963 people have browsed it

我现在想要配置出这样一个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:>
Copy after login
Copy after login

回复内容:

我现在想要配置出这样一个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:>
Copy after login
Copy after login

<code class="lang-php">'/news/<alias:>/list-<page:>'=>'/news/list'
</page:></alias:></code>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template