复制代码 代码如下:


<div>

<?php
$query=mysql_query("select * from cont">

Home > php教程 > php手册 > 无刷新动态加载数据 滚动条加载适合评论等页面

无刷新动态加载数据 滚动条加载适合评论等页面

WBOY
Release: 2016-06-06 20:27:19
Original
1061 people have browsed it

无刷新动态加载数据,滚屏加载更多数据,适合评论等页面,具体实现如下,感兴趣的朋友可以参考下

滚屏加载更多数据,适合评论等页面

本例的数据库很简单,一看就明了

无刷新动态加载数据 滚动条加载适合评论等页面

 

复制代码 代码如下:




$query=mysql_query("select * from content order by id desc limit 0,10");
while ($row=mysql_fetch_array($query)) {
?>











js文件

复制代码 代码如下:




result.php

复制代码 代码如下:


include("conn.php");

$page = intval($_GET['page']); //获取请求的页数
$start = $page*5;
$query=mysql_query("select * from content order by id desc limit $start,5");
while ($row=mysql_fetch_array($query)) {
$arr[] = array(
'content'=>$row['message'],
'author'=>$row['id'],
'date'=>date('m-d H:i',strtotime($row['updatetime']))
);
}
echo json_encode($arr); //转换为json数据输出
?>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template