后面可以了解的东西

  1. Rocket API
  2. JavaFX、WPF/UWP、Electron
  3. 小程序、公众号
  4. diboot
  5. vue3文档:https://v3.cn.vuejs.org/guide/introduction.html#vue-js-%E6%98%AF%E4%BB%80%E4%B9%88
在以下代码中,不删除已有的东西之外,加入登录注册的按钮并且可以跳转到登录注册界面,没登录的时候自动判断用户是否登录 <?php require './common/init.php'; require './common/function.php'; // 获取当前页码 $page = max(input('get', 'page', 'd'), 1); // 每页显示的条数 $size = 4; $sql = 'SELECT count(*) FROM `wish`'; if (!$res = mysqli_query($link, $sql)) { exit("SQL[$sql]执行失败:" . mysqli_error($link)); } $total = (int) mysqli_fetch_row($res)[0]; // 查询所有愿望 $sql = 'SELECT `id`,`name`,`content`,`time`,`color` FROM `wish` ORDER BY `id` DESC LIMIT ' . page_sql($page, $size); if (!$res = mysqli_query($link, $sql)) { exit("SQL[$sql]执行失败:" . mysqli_error($link)); } $data = mysqli_fetch_all($res, MYSQLI_ASSOC); mysqli_free_result($res); // 查询结果为空时,自动返回第1页 if (empty($data) && $page > 1) { header('Location: ./index.php?page=1'); exit; } // 编辑或删除愿望 $id = max(input('get', 'id', 'd'), 0); $action = input('get', 'action', 's'); if ($id) { $password = input('post', 'password', 's'); $sql = 'SELECT `name`,`content`,`color`,`password` FROM `wish` WHERE `id`=' . $id; if (!$res = mysqli_query($link, $sql)) { exit("SQL[$sql]执行失败:" . mysqli_error($link) . $sql); } if (!$edit = mysqli_fetch_assoc($res)) { exit('该愿望不存在!'); } mysqli_free_result($res); $checked = isset($_POST['password']) || empty($edit['password']); if ($checked && $password !== $edit['password']) { $tips = '密码不正确!'; $checked = false; } // 删除愿望 if ($checked && $action == 'delete') { $sql = 'DELETE FROM `wish` WHERE `id`=' . $id; if (!mysqli_query($link, $sql)) { exit('SQL执行失败:' . mysqli_error($link)); } header('Location: ./index.php'); exit; } } mysqli_close($link); require './view/index.html';
06-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值