?? content.php
字號:
<?php
// 初始化Session
session_start();
// 包含數據庫連接文件
require ('dbconnect.php');
?>
<html>
<head>
<meta http-equiv='content-type' content='text/html; charset=gb2312'>
<!-- 每隔12秒刷新聊天內容 -->
<meta http-equiv=refresh content='12;url=content.php'>
</head>
<body>
<?php
// print $color;
$curuser=$SESSION['UserName'];
// 構造SQL語句,該語句從messages表中選擇最后的15條聊天記錄
$strSQL="select * from messages order by MesID desc limit 0,15";
// 執行strSQL語句
$result=mysql_query($strSQL,$conn);
// 現實最近的15條聊天記錄
while($msg=mysql_fetch_array($result)) {
// 顯示發言者和時間
echo "[<font color=red>".$msg[FromUser]."</font>]".$msg['Time']."對";
// 顯示發言者發言的對象
echo "[<font color=red>".$msg[ToUser]."</font>]說:";
// 顯示聊天內容
echo "<font color='".$msg[Color]."'>".$msg[Content]."</font>";
echo "<br>";
}
// 關閉連接
mysql_close($conn);
?>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -