首先打开application目录创建一个php文件,给这个文件定义名字为hzq.php并且复制以下代码
<?php
/*
naem:求学疯子
time:2020/2/14
*/
include("header.php");
$host='127.0.0.1';
$dbuser='';//数据库名一般为root
$pwd='';//数据库密码
$username='';//表的名称
$db=new mysqli($host,$dbuser,$pwd,$username);
$db->query("SET NAMES UTF8");
$sql = "SELECT*FROM logs ORDER BY id DESC";
$is= $db->query($sql);
if ($is===false) {
echo"sql问题,联系QQ3200142523询问";
exit;
}
$rows=[];
while( $row = $is->fetch_array(MYSQLI_ASSOC) ){//获取最新一条数据,代码执行一次获取一次,依次往下走
$rows[]=$row;
}
?>
<!--------------------------HTML部分-------------------->
<html>
<head>
<style>
king{
float: right;
}
king2{
float: right;
color: green;
}
#oval {
width: 200px;
height: 100px;
background: #e9337c;
-webkit-border-radius: 100px / 50px;
-moz-border-radius: 100px / 50px;
border-radius: 100px / 50px;
}
.noe {
width: 100px;
height: 100px;
line-height: 100px;
text-align: center;
margin: 0 auto;
margin-top: 0px;
border-radius: 50%;
background: -webkit-radial-gradient(circle closest-side,#fff 82%,red 18%);
}
</style>
</head>
<div class="mdui-row">
<div class="mdui-col-md-6 mdui-col-offset-md-2">
<div class="mdui-card" style="overflow: inherit;">
<div class="mdui-card-primary" style="padding: 10px 16px 10px 16px;">
<div class="mdui-card-primary-title mdui-text-center">获赞墙</div>
<!--分界线-->
<?php
foreach($rows as $row){
?>
<HR/>
<div><img src="//q4.qlogo.cn/headimg_dl?dst_uin=<?php echo $row['uin'];?>&spec=100" style="width: 100px; height: 100px;" alt="avatar" class="noe">
<king><h4 stye='color:red;'>该用户在<?php echo $row['time'];?></h4><br>赞了扣扣【<?php echo $row['like_uin'];?>】<br><?php echo$row['count'];?>次</king>
<?php
}
?>
</div>
</html>
<?php
include("footer.php");
?>