根据启用或禁用多个模块状态对用户的页面访问



我有一个场景,我有一个页表,并且该页面基于多个模块启用或禁用。一个页面可以依赖于多个模块,一个模块依赖于另一个模块。如果禁用其中的任何模块,则该页面将被禁用。此外,如果页面本身被禁用,它不会带来记录。我在模块表和页表中有一个状态字段,两者都显示它是否已启用。为此,我创建了一个中间表,用于存储依赖项。但是我在sql中找不到任何方法可以做到这一点。请参阅下面的sql表,如果您可以给我更好的解决方案。

1(文件表

file_id|  file_name           |   file_title         |display_in  |dependent_on
1  |user_configuration.php|  User Configuration  |3             | 4

2(文件依赖关系(中表(

id |  module_id | file_id
1  |  3         |   1     

3(模块表

module_id | mudule_name           |   status
3         | Configuration module  |     1
4         | Customers module       |    0
$qry =  mysql_query("SELECT * FROM files f 
LEFT JOIN file_dependencies fd on fd.file_id = f.file_id
LEFT JOIN modules m on m.module_id = fd.module_id where fd.module_id = '3'");
while($row = mysql_fetch_array($qry)){
if($row['display_in'] && $row['dependent_on']){
// write your own custom code
}
}

您需要使用表中的连接并检查依赖项和 php 代码中显示的内容

最新更新