<?php header("Content-Type:text/html; charset=gbk"); require('../../include/connect.php'); //连接数据库 mysql_query("set names gbk"); function file_list($path) { if ($handle = opendir($path))//打开路径成功 { while (false !== ($file = readdir($handle)))//循环读取目录中的文件名并赋值给$file { if ($file != "." && $file != "..")//排除当前路径和前一路径 { if (is_dir($path."/".$file)) { // echo $path.": ".$file."
";//去掉此行显示的是所有的非目录文件 file_list($path."/".$file); } else { echo $path."/".$file."
"; $insert_sql = "insert into file values(NULL,'".$file."','".$path."','beizhu',1,0,now(),'shanchuanren','shenheren',now(),'".$path."s/".$file."')"; //mysql_query($insert_sql); } } } } } $path = "."; file_list($path); ?>
php 获取类库路径,php 遍历文件夹及文件,获取文件名和文件路径存入数据库中...
最新推荐文章于 2022-03-23 11:13:31 发布