where(['name'=>$param['s']])->value('id'); if(empty($id)){ throw new \think\exception\HttpException(406, '找不到相关记录'); } } $detail = (new PagesModel())->detail($id); if(empty($detail)){ throw new \think\exception\HttpException(406, '找不到相关记录'); } PagesModel::where('id', $id)->inc('read')->update(); View::assign('detail', $detail); return view($detail['template']); } }