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

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

全員に返信(1)
巴扎黑
'/news/<alias:\w+>/list-<page:\d+>'=>'/news/list'
いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!