this.ctx.request.body //获取post提交的数据
this.ctx.request.url //获取get的url
this.ctx.request.query //获取get传值
this.ctx.status //设置状态码
this.ctx.state //设置模板的全局变量
1.获取动态路由 this.ctx.parmas
//配置动态路由
router.get('/:id',controller.news.newslist)
//获取动态路由
class HomeController extends Controller {
async index() {
await this.ctx.render('index')
console.log(this.ctx.params)
}
}
module.exports = HomeController;