路由设置为了简化url地址,可自定义路由,源url地址为
http://phpcms.hbsjsd.cn/cata/index?cid/12.html
简化后http://phpcms.hbsjsd.cn/cates-12.html
/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+']);
/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+']);