}
2:创建展示页面:form:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Document</title>
</head>
<body>
<center>
名称:<input type="text" name="uname">
<input type="button" value="搜索" οnclick="search()"><br />
<div id="div1">
<table border="1">
<tr>
<td>ID</td>
<td>用户名</td>
<td>密码</td>
<td>手机号</td>
<td>操作</td>
</tr>
@foreach($arr as $k=>$v)
<tr>
<td>{{$v->id}}</td>
<td>{{$v->uname}}</td>
<td>{{$v->pwd}}</td>
<td>{{$v->photo}}</td>
<td><a href="{{url('det')}}?id={{$v->id}}">删除</a><a href="{{url('up')}}?id={{$v->id}}">修改</a></td>
</tr>
@endforeach
</table>
当前页<?php echo $page?>共<?php echo $sum_page?>
<a href="javascript:void (0)" οnclick="page(1)">首页</a>
<a href="javascript:void (0)" οnclick="page(<?php echo $last?>)">上一页</a>
<a href="javascript:void (0)" οnclick="page(<?php echo $next?>)">下一页</a>
<a href="javascript:void (0)" οnclick="page(<?php echo $sum_page?>)">尾页</a>
</div>
</center>
</body>
</html>
<script>
function page(page){
//var search=document.getElementsByName('search')[0].value;
var ajax=new XMLHttpRequest();
ajax.open('get','{{url('acc')}}?page='+page);
ajax.send();
ajax.onreadystatechange=function(){
if(ajax.readyState==4&ajax.status==200){
document.getElementById('div1').innerHTML=ajax.responseText;
}
}
}
</script>