CREATE TABLE menu (
id tinyint(4) NOT NULL auto_increment,
parent_id tinyint(4) DEFAULT '0' NOT NULL,
name varchar(20),
url varchar(60),
PRIMARY KEY (id)
);
这张表中
id 为索引
parent_id 用来保留上一级菜单的id号,假如是一级菜单则为0
name 为菜单的称号,也就是要在页面上显示的菜单内容
url 假如某菜单为末级菜单,则需求指定该毗连的url地址,这个字段就是用来保留此地址的,其他非末级菜单,该字段为空
好了,数据库有了,你就能够添加一些纪录了,上面是我做测试的时分,利用的一些纪录:
INSERT INTO menu VALUES ( '1', '0', '人事办理', '');
INSERT INTO menu VALUES ( '2', '0', '通信交换', '');
INSERT INTO menu VALUES ( '3', '1', '档案办理', '');
INSERT INTO menu VALUES ( '4', '1', '考勤办理', 'http://localhost/personal/attendance.php');
INSERT INTO menu VALUES ( '5', '2', '通信录', '');
INSERT INTO menu VALUES ( '6', '2', '收集会议', '');
INSERT INTO menu VALUES ( '7', '3', '新增档案', 'http://localhost/personal/add_achive.php');
INSERT INTO menu VALUES ( '8', '3', '查询档案', 'http://localhost/personal/search_archive.php');
INSERT INTO menu VALUES ( '9', '3', '删除档案', 'http://localhost/personal/delete_archive.php');
INSERT INTO menu VALUES ( '10', '5', '新增通信纪录', 'http://localhost/communication/add_address.php');
INSERT INTO menu VALUES ( '11', '5', '查询通信纪录', 'http://localhost/communication/search_address.php');
INSERT INTO menu VALUES ( '12', '5', '删除通信纪录', 'http://localhost/communication/delete_address.php');
INSERT INTO menu VALUES ( '13', '6', '召闭会议', 'http://localhost/communication/convence_meeting.php');
INSERT INTO menu VALUES ( '14', '6', '会议查询', 'http://localhost/communication/search_meeting.ph');