~/gitee.com/mxycool/workspace/docker-compose.yml
添加 - '/Volumes:/mnt'
$ docker-compose down
$ docker-compose up -d
把本机/Volumes 挂载到 容器的 /mnt
点击进入docker容器命令行查看
[root@workspace: /mnt/老毛桃U盘] #
扫描目录
public static function scanDir(string $dir, callable $handler) {
if (false == is_dir($dir)) {
throw new InvalidArgumentException(sprintf("No such directory: \"%s\"", $dir), 2);
}
if ($dh = opendir($dir)) {
/** @var $dh resource */
while (false !== ($file = readdir($dh))) {
/** @var $file string */
if (strncmp($file, ".", 2) !== 0
&& strncmp($file, "..", 2) !== 0) {
call_user_func($handler, $file);
}
}
closedir($dh);
}
}
$dir = "/mnt/老毛桃U盘/汽车图片/images"; self::scanDir($dir, function($filename) { printf("%s\n", $filename); });