Page de liste des actualités du système de communiqués de presse sur le développement PHP
Créer une page de liste d'actualités fichier new_list.php
Toutes les actualités que nous publions seront affichées sur cette page
Trouvez d'abord les données de la base de données, le code est le suivant
<?php
header("content-type:text/html;charset=utf8");
$conn=mysqli_connect("localhost","root","root","News");
mysqli_set_charset($conn,'utf8'); //设定字符集
$sql="select * from new";
$que=mysqli_query($conn,$sql);
?>data Je l'ai découvert, nous voulons que nos données soient affichées sur la page HTML, nous devons utiliser un mélange de langages HTML et PHP
Le code est le suivant
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP中文网</title>
<style>
table{
margin-top: 10px;
}
</style>
</head>
<body>
<a href="new.html">返回发布新闻</a>
<table border="1" cellspacing="0" width=360 >
<tr>
<th>编号</th>
<th>文章标题</th>
<th>文章内容</th>
<th>编辑文章</th>
<th>发布时间</th>
</tr>
<?php
while($row=mysqli_fetch_array($que)){
?>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['title']?></td>
<td><?php echo $row['content']?></td>
<td>
<a href="new_ed.php?id=<?php echo $row['id']?>">修改</a>
<a href="new_del.php?id=<?php echo $row['id']?>">删除</a>
</td>
<td><?php echo $row['cre_time']?></td>
<?php }
?>
</tr>
</table>
</body>
</html>Le code complet du fichier new_list.php est le suivant
<?php
header("content-type:text/html;charset=utf8");
$conn=mysqli_connect("localhost","root","root","News");
mysqli_set_charset($conn,'utf8'); //设定字符集
$sql="select * from new";
$que=mysqli_query($conn,$sql);
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP中文网</title>
<style>
table{
margin-top: 10px;
}
</style>
</head>
<body>
<a href="new.html">返回发布新闻</a>
<table border="1" cellspacing="0" width=360 >
<tr>
<th>编号</th>
<th>文章标题</th>
<th>文章内容</th>
<th>编辑文章</th>
<th>发布时间</th>
</tr>
<?php
while($row=mysqli_fetch_array($que)){
?>
<tr>
<td><?php echo $row['id'];?></td>
<td><?php echo $row['title']?></td>
<td><?php echo $row['content']?></td>
<td>
<a href="new_ed.php?id=<?php echo $row['id']?>">修改</a>
<a href="new_del.php?id=<?php echo $row['id']?>">删除</a>
</td>
<td><?php echo $row['cre_time']?></td>
<?php }
?>
</tr>
</table>
</body>
</html>Le code ci-dessus peut afficher tout les actualités que nous publions sous forme de tableau sur la page HTML
nouveau fichier
<a href="new.html">返回发布新闻</a>
<table cellspacing="0" border="1" width="360">
<tbody><tr>
<th>编号</th>
<th>文章标题</th>
<th>文章内容</th>
<th>编辑文章</th>
<th>发布时间</th>
</tr>
<tr>
<td>1</td>
<td>你好吗</td>
<td>现在的你过的好吗</td>
<td>
<a href="new_ed.php?id=1">修改</a>
<a href="new_del.php?id=1">删除</a>
</td>
<td>2016-11-03 09:31:26</td>
</tr>
</tbody></table>
Aperçu
Clear
Les étudiants qui ont regardé ce cours apprennent également
Parlons brièvement de la création d'une entreprise en PHP
Introduction rapide au développement web front-end
Développement pratique à grande échelle par Tianlongbabu du cadre MVC version Mini imitant le site Web de l'encyclopédie des choses embarrassantes
Premiers pas avec le développement pratique PHP : création rapide de PHP [Small Business Forum]
Vérification de connexion et forum de discussion classique
Collecte de connaissances sur les réseaux informatiques
Démarrage rapide de la version complète de Node.JS
Le cours front-end qui vous comprend le mieux : HTML5/CSS3/ES6/NPM/Vue/...[Original]
Écrivez votre propre framework PHP MVC (40 chapitres en profondeur/gros détails/à lire absolument pour que les débutants progressent)
















Le didacticiel n'est pas disponible au téléchargement pour le moment. Le staff est actuellement en train de l'organiser. Veuillez prêter plus d'attention à ce cours à l'avenir ~ 