Ai
2 Star 2 Fork 1

闪电侠的右手/php网站实现文件上传管理
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
msg.php 1.56 KB
一键复制 编辑 原始数据 按行查看 历史
fansOfTech 提交于 2018-03-11 20:01 +08:00 . first commit
<?php
include('db.php');
$mysqli_result=$mysqli->query("SELECT*FROM msg ORDER BY id DESC");//把遍历数据库结果赋值给result类的对象
//并且按照新旧时间顺序排列
//var_dump($mysqli_result);
$rows=array();
while(true){
$row=$mysqli_result->fetch_array(MYSQLI_ASSOC);//把result类对象拆分成数组 赋值给row
if($row==false){break;}
$rows[]=$row;
}
//var_dump($rows); //括号里不能写成$rows[]的形式
?>
<html>
<head>
<meta charset='utf-8'/>
<title>留言板</title>
<style>
.add{width:600px;margin:0px auto;overflow:hidden;}
.add textarea{width:99%;height:100px;}
.add .user{float:left;}
.add .btn{float:right;}
.msg{width:500px;margin:20px auto;overflow:hidden;}
.item{border:solid 1px #ccc;margin:10px 0;}
.item .user{float:left;}
.item .time{float:right;}
</style>
</head>
<body>
<div class="add">
<form action="save.php" method="post">
<textarea name="msg">留言内容</textarea>
<input class="user" name="user" type='text'/>
<input class="btn" type='submit' value='发表'/>
</form>
</div>
<div class"msg">
<?php
foreach($rows as $row){
//for($i=0;$i<count($rows);$i++){
$t=date("Y-m-d H:i:s",$row['intime']); //Y-m-d H:i:s
//var_dump($row);
?>
<div class="item">
<span class="user"><?php echo $row['username']; ?></span>
<span class="time"><?php echo $t; ?></span>
<div style="clear:both;"></div>
<p><?php echo $row['content']; ?></p>
</div>
<?php
}
?>
</div>
</body>
</html>
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/shaoeric/php_web_site_implementation_of_file_upload_management.git
git@gitee.com:shaoeric/php_web_site_implementation_of_file_upload_management.git
shaoeric
php_web_site_implementation_of_file_upload_management
php网站实现文件上传管理
master

搜索帮助