php+ajax制作无刷新留言板,phpajax刷新留言板
本文就是和大家分享一款由php结合ajax实现的无刷新留言板,先给大家看一下最后的效果图:
数据库连接代码如下:
<?php $conn = @mysql_connect("localhost","root","root") or die ("MySql连接错误"); mysql_select_db("demo",$conn); mysql_query("set names 'utf8'"); ?>
index.php文件代码如下:
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="bbs.css" type="text/css" rel="stylesheet"> <title>无刷新显示回帖</title> <script src="bbs.js" type="text/javascript"></script> </head> <body> <h1 id="无刷新显示回帖">无刷新显示回帖</h1> <div id="thread"> <?php include("conn.php"); $sql = "select * from `bbs_post` where `threadid` ='1' order by id asc"; $query =mysql_query($sql); while($row = mysql_fetch_array($query)){ ?> <div class="post" id="post<?php echo $row['id'];?>"> <div class="post_title"><?php echo $row['title'];?> [<?php echo $row['username'];?>]</div> <div class="post_content"><pre class="brush:php;toolbar:false"><?php echo $row['content'];?>
回帖 | |
姓名: | |
标题: | |
内容: | |

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

Dreamweaver CS6
Visual web development tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),