分类信息查询的功能实现


图片描述

图片描述

类似这类的分类信息查询的有没有一个思路推荐 或者 一个案例借鉴下 ,很急,在线等大神

Ajax php JavaScript

会说话的老妖精 11 years ago

标签系统

tag_id | tags | tag_type
1 | 2013 | year
2 | 2014 | year
3 | Dr.M | actor

tag_relation
object_id | tag_id
1 | 1
1 | 2

Moziu answered 11 years ago

我推荐使用4个关联表来达到最灵活有效的实现。

type 表
id, name

type_attribute 表
id, type_id(关联type表的id),name,...(可以定义一些属性,比如多选,必选之类)

type_attribute_option 表
id, attribute_id(关联type_attribute表的id),name

relation 表
id, goods_id(商品的id),attribute_id(关联type_attribute的id),attribute_option(关联type_attribute_option的id)

那么剩下的就很简单了。就按照你第二个例子里面的电影网站为例,
type 顾名思义就是种类了,电影就是一种大的种类
type_attribute 就是类型里面的一些属性,比如电影有类型,年代,地区,语言,属性什么的。
type_attribute_option 就是这些属性的一些选项,比如年代有 2015,2014

然后每个电影使用 relation 表来和 attribute 和 option 关联就可以了。

蛋疼的一颗葱 answered 11 years ago

Your Answer