Blogger Information
Blog 31
fans 0
comment 0
visits 14263
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
递归函数 用户表
木子木杉
Original
432 people have browsed it

封装一个递归函数,目的是删除所有缓存目录

  1. $dir = __DIR__ . DIRECTORY_SEPARATOR . 'func' . DIRECTORY_SEPARATOR . 'shanchu';
  2. echo $dir;
  3. die;
  4. echo DIRECTORY_SEPARATOR;
  5. function delete_dir_file($dir)
  6. {
  7. $flag = false;
  8. if (is_dir($dir)) {
  9. //打开目录流 成功返回一个资源类型 目录句柄 否则false
  10. if ($handle = opendir($dir)) {
  11. while (($file = readdir($handle)) !== false) {
  12. // echo ($file) . '<br>';
  13. if ($file != '.' && $file != '..') {
  14. if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
  15. delete_dir_file($dir . DIRECTORY_SEPARATOR . $file);
  16. } else {
  17. unlink($dir . DIRECTORY_SEPARATOR . $file);
  18. }
  19. }
  20. }
  21. closedir($handle);
  22. if (rmdir($dir)) {
  23. $flag = true;
  24. }
  25. }
  26. }
  27. return $flag;
  28. }
  29. $res = delete_dir_file($dir);
  30. if ($res) {
  31. echo json_decode(['msg' => '清除成功', 'satatus' => 1], 320);
  32. }

建用户表

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 usernameFROMuserWHEREid>3;
查SELECT
FROM user WHERE USERNAME=’张三’;

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post