在使用 Moodle 中的 Web 服务上传的课程中解压缩文件

Unzip files in a course uploaded with a Web Service in Moodle

我想在 Moodle 中制作一个 WS 来上传一个 zip 文件并在内部解压缩,这只会在提供的课程中创建 zip 内的文件。

我一直在 Internet 和 Moodle 的代码中搜索,但没有找到适合我的东西。

我对Moodle中WS的结构比较熟悉,因为我做过3个很简单的WS,上传文件或多或少都知道,就是不知道怎么解压在心情中。

如果有人知道如何做或有任何可能有用的示例或文档,那将会很有帮助。

提前致谢。

看看get_file_packer

$packer = get_file_packer('application/zip');
$files = $packer->extract_to_pathname('zipfile.zip', $zipdir);