1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkPHP [ WE CAN DO IT JUST THINK ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: liu21st <liu21st@gmail.com>
- // +----------------------------------------------------------------------
- use think\facade\Route;
- use app\common\model\Category;
- use think\facade\Template;
- Route::pattern([
- 'name' => '\w+',
- 'id' => '\d+',
- 'cid' => '\d+',
- 'page' => '\d+',
- 'year' => '\d+',
- 'month' => '\d+',
- 'day' => '\d+',
- ]);
- Route::get('think', function () {
- return 'hello,ThinkPHP6!';
- });
- Route::view('/404', '404');
- Route::get('/all', 'index/article/index');
- Route::get('/:year/:month/:day/:id', 'index/article/read');
- Route::get('/:year/:month', 'index/article/archive');
- Route::post('/dolike', 'index/article/dolike');
- Route::get('/tags/:name', 'index/article/tags');
- Route::get('/time', 'index/article/time')->append(['_aside' => true]);
- Route::get('/about', 'index/index/about')->append(['_aside' => true]);
- $list = Category::getList();
- foreach ($list as $key => $value) {
- if ($value->template == 'article') {
- Route::get('/'.$value->url, 'index/article/index')->append(['cid' => $value->id]);
- }
- }
|