PHP - 如何将大量文件路径存储到MySQL数据库?
我需要将大量文件存储到 MySQL 数据库中。这些文件存储在服务器上,我需要做的是这样的:
ID artist album path
123 Artist Name Album Name /music/Artist Name/Album Name/Music Name.mp3
但正如我所说,这是一个非常大量的文件,手动添加它们不是一个选择。我想知道是否有人知道一种简单的方法让我至少将路径导入数据库。我可以在之后实现艺术家和专辑,并且可以手动完成。
有什么想法吗?
I need to store a very large number of files to a MySQL database. These files are stored on the server, and what I need to do is something like this:
ID artist album path
123 Artist Name Album Name /music/Artist Name/Album Name/Music Name.mp3
But as I said, it's a very large number of files, and add them manually isn't an option. I'm wondering if anyone knows an easy way for me to import at least the path into the database. The Artist and Album I can implement after, and it's possible to do it manually.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
提示:使用 PHP 递归地查找文件结构中的 *.mp3 文件或您要查找的任何扩展名。对于返回的每个结果,将整个路径、文件大小等存储在数据库表中。您可能需要考虑使用 Python 语言来实现此目的。
A clue: Use PHP to recursively look through your file structure for *.mp3 files, or whichever the extensions you are looking for. For each result returned, store the whole path, filesize etc. in the database table. You might want to consider using Python language for this.
你可能需要这样的东西:
you maybe need something like this: