<form autocomplete="off" method="get" action="{:url('comment/index')}">
<input value="{notempty name='keywords'}{$keywords}{/notempty}" type="text" placeholder="请输入关键词" class="form-control" name="keywords" autocomplete="off" style="display: inline-block;
width: 85%;">
<input type="submit" value="搜索" class="btn btn-sm btn-primary article_search">
</form>
<table>
....
</table>
public function index()
{
$key = input('keywords');
$map = [];
if($key) {
$map['user_name|user_comment']=['like','%'.$key.'%'];
}
$res = db('comment')->order('create_time desc')->where($map)->paginate(10);
$this->assign(array(
'res'=>$res,
'keywords'=>$key,
));
return view('',['title'=>'评论管理']);
}