Home  >  Article  >  php教程  >  php递归实现无限分类原理

php递归实现无限分类原理

PHP中文网
PHP中文网Original
2016-05-25 17:11:081160browse

代码

DROP TABLE IF EXISTS `navs`;
CREATE TABLE IF NOT EXISTS `navs` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(32) NOT NULL,
  `pid` int(11) NOT NULL DEFAULT '0',
  `path` char(128) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
INSERT INTO `navs` (`id`, `name`, `pid`) VALUES
(1, '舞文弄墨', 0, '-1-'),
(2, '似水流年', 2, '-2-'),
(3, '隔岸观火', 2, '-2-3-'),
(4, 'WEB开发', 0, '-4-'),
(5, 'PHP', 4, '-4-5-'),
(6, 'Javascript', 4, '-4-6-');
(7, 'jquery', 6, '-4-6-7-');

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn