扫码关注官方订阅号
据说前台用ajax,后面用php处理数据库.... 新手懵了==!有专业人士指导下吗 感激不尽..!
闭关修行中......
前端是javascript实现,使用JQuery可以简化一些:
$.get( '/getNewReply.php', {uid:uid} function(data){ // 更新html的内容,根据data } );
在服务器端的,getNewReply.php来实现查询数据库:
$sql = "select count(id) from replies where uid={$_GET['uid']}"; $r = $db->execute($sql); echo json_encode($r);
类似这样的代码,但是需要根据你的数据库和其他的来修改代码。
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
前端是javascript实现,使用JQuery可以简化一些:
$.get( '/getNewReply.php', {uid:uid} function(data){ // 更新html的内容,根据data } );在服务器端的,getNewReply.php来实现查询数据库:
$sql = "select count(id) from replies where uid={$_GET['uid']}"; $r = $db->execute($sql); echo json_encode($r);类似这样的代码,但是需要根据你的数据库和其他的来修改代码。