常見問題

thinkphp6路由設(shè)置

常見問題

2549

字體:

1、路由設(shè)置 域名/cates/1.html

Route::group('cates', function () {
    Route::rule('/:cid', '/cate/index');
    Route::rule('/:cid', 'cate/index');
})->ext('html')->pattern(['method' => 'get', 'cid' => '\d+']);
Route::group('page', function () {
    Route::rule('/:cid', '/page/index');
    Route::rule('/:cid', 'page/index');
})->ext('html')->pattern(['method' => 'get', 'cid' => '\d+']);
Route::group('art', function () {
    Route::rule('/:aid', '/article/index');
    Route::rule('/:aid', 'Article/index');
})->ext('html')->pattern(['method' => 'get', 'aid' => '\d+']);

2、路由設(shè)置 域名/cates-1.html

Route::get('cates-'.":cid", '/cate/index')->ext('html')->pattern(['method' => 'get', 'cid' => '\d+']);
Route::get('page-'.":cid", '/page/index')->ext('html')->pattern(['method' => 'get', 'cid' => '\d+']);
Route::get('art-'.":aid", 'Article/index')->ext('html')->pattern(['method' => 'get', 'aid' => '\d+']);



[聲明]原創(chuàng)不易,請(qǐng)轉(zhuǎn)發(fā)者備注下文章來源(hbsjsd.cn)【速建時(shí)代】。