[英]Algorithm to compare files and sub directories in main directory to the database
I need to update the file paths in a directory recursively in the database. 我需要在数据库中递归更新目录中的文件路径。 Like if I made any changes in the directory, then that has to be updated in the database.
就像如果我在目录中进行了任何更改一样,则必须在数据库中对其进行更新。 What is the best and fastest way to do this using PHP and MySQL.
使用PHP和MySQL的最佳和最快方法是什么?
In your MySQL database you must have these tables: 在您的MySQL数据库中,您必须具有以下表:
Directory{
directory_id: integer;
directory_name: varchar;
directory_path: varchar;
parent_id: fk_to_directoy_id;
}
File{
file_id: integer;
file_name: varchar;
directory_id: fk_to_directory_id;
}
so you can build the hierarchical directory structure and then attach files to its directory. 因此您可以构建分层目录结构,然后将文件附加到其目录。
Then you just need a backend in php to manage these tables. 然后,您只需要php中的后端即可管理这些表。 (Look to a framework to make it easy Symfony )
(寻找一个使Symfony变得容易的框架)
Hope it helped you. 希望对您有所帮助。 Good luck.
祝好运。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.