Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
$dir = __DIR__ . DIRECTORY_SEPARATOR . 'func' . DIRECTORY_SEPARATOR . 'shanchu';
echo $dir;
die;
echo DIRECTORY_SEPARATOR;
function delete_dir_file($dir)
{
$flag = false;
if (is_dir($dir)) {
//打开目录流 成功返回一个资源类型 目录句柄 否则false
if ($handle = opendir($dir)) {
while (($file = readdir($handle)) !== false) {
// echo ($file) . '<br>';
if ($file != '.' && $file != '..') {
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
delete_dir_file($dir . DIRECTORY_SEPARATOR . $file);
} else {
unlink($dir . DIRECTORY_SEPARATOR . $file);
}
}
}
closedir($handle);
if (rmdir($dir)) {
$flag = true;
}
}
}
return $flag;
}
$res = delete_dir_file($dir);
if ($res) {
echo json_decode(['msg' => '清除成功', 'satatus' => 1], 320);
}
Navicat Lite->连接->mysql->连接名php,用户名root,接口3306->新建数据库->新建表->建字段id/username/password保存表名为user
在命令提示符中
show databases展示所有的根目录
show tables 展示所有的表
SELECT FROM user
;展示user所有内容
插入INSERT INTO user SET username=’李四’,password=’123456’;
选SELECT username
FROMuser
WHEREid
>3;
查SELECT FROM user
WHERE USERNAME=’张三’;