解决方法:get传参,保留查询条件
php
$get = input('get.');
$phone = input('get.phone');
$email = input('get.email');
$pageParam = ['query' =>[]];
if ($phone) {
$userModel->where('phone', 'like', "%{$phone}%");
$this->assign('phone', $phone);
$pageParam['query']['phone'] = $phone;
}
if ($email) {
$userModel->where('email', 'like', "%{$email}%");
$this->assign('email', $email);
$pageParam['query']['email'] = $email;
}
$list = $userModel->paginate(3, false, $pageParam);
$this->assign('list', $list);
$this->assign('title', '会员列表');
$this->assign('breadcrumb', ['后台首页', '用户管理', '会员列表']);
return $this->fetch();
html
<div class="container">
<!-- 查询BEG -->
<div class="row">
<div class="col-xs-12">
<div class="me-searchbox">
<form class="form-inline" role="form" method="get">
<div class="form-group">
<label for="phone">手机</label>
<input type="text" class="form-control" name="phone" placeholder="手机" value="{$phone ? $phone : '';}">
</div>
<div class="form-group">
<label for="email">邮箱</label>
<input type="text" class="form-control" name="email" placeholder="邮箱" value="{$email ? $email : '';}">
</div>
<button type="submit" class="btn btn-default">查询</button>
</form>
</div>
</div>
</div>
<!-- 查询END -->
<!-- 表格BEG -->
<div class="row">
<div class="col-xs-12">
<table class="table table-bordered">
<thead>
<tr>
<th><input type="checkbox"></th>
<th>ID</th>
<th>妮称</th>
<th>手机</th>
<th>邮箱</th>
</tr>
</thead>
<tbody>
{volist name='list' id='user'}
<tr>
<td><input type="checkbox"></td>
<td>{$user.id}</td>
<td>{$user.nickname}</td>
<td>{$user.phone}</td>
<td>{$user.email}</td>
</tr>
{/volist}
</tbody>
</table>
</div>
</div>
<!-- 表格END -->
<!-- 分页导航BEG -->
<div class="row">
<div class="col-xs-12">
{$list->render()}
</div>
</div>
<!-- 分页导航END -->
</div>
参考资料 参考