Home PHP Libraries Other libraries PHP unlimited classification Category class library
PHP unlimited classification Category class library
<?php
class Category {
  private $model;                                                           //分类的数据表模型
  private $rawList = array();                                              //原始的分类数据
  private $formatList = array();                                           //格式化后的分类
  private $error = "";                                                      //错误信息
  private $icon = array('&nbsp;&nbsp;│', '&nbsp;&nbsp;├ ', '&nbsp;&nbsp;└ ');  //格式化的字符
  private $fields = array();                                               /
  public function __construct($model = '', $fields = array()) {
    if (is_string($model) && (!empty($model))) {
      if (!$this->model = D($model))
        $this->error = $model . "模型不存在!";
    }
    if (is_object($model))
      $this->model = &$model;
    $this->fields['cid'] = $fields['0'] ? $fields['0'] : 'id';
    $this->fields['pid'] = $fields['1'] ? $fields['1'] : 'pid';
    $this->fields['name'] = $fields['2'] ? $fields['2'] : 'name';
    $this->fields['fullname'] = $fields['3'] ? $fields['3'] : 'fullname';
  }

This is a PHP category library with unlimited categories. Friends who need it can download it and use it.

Disclaimer

All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn

Related Article

PHP Category class library unlimited categories PHP Category class library unlimited categories

06 Jun 2020

CategoryController.class.php is a controller file used to demonstrate how to use unlimited category processing classes.

PHP unlimited classification (tree class)_PHP tutorial PHP unlimited classification (tree class)_PHP tutorial

21 Jul 2016

PHP unlimited classification (tree class). Copy the code as follows: ?php //Simulate PHP unlimited classification query results return array( array( 'id'=1, 'pid'=0, 'name'='Homepage' ), array( 'id'=2, ' pid'=0, 'name'='News' ), ​​array( 'id'=

[php unlimited classification] summarizes the most comprehensive php unlimited classification library download and text video tutorial [php unlimited classification] summarizes the most comprehensive php unlimited classification library download and text video tutorial

19 May 2017

PHP infinite classification is often used to generate infinite classification menus. This topic mainly introduces some popular PHP unlimited classification articles and code snippets, some commonly used PHP unlimited classification library downloads, and PHP unlimited classification video tutorials!

PHP unlimited classification to get the top category ID, PHP top_PHP tutorial PHP unlimited classification to get the top category ID, PHP top_PHP tutorial

12 Jul 2016

PHP unlimited classification gets the top classification ID, PHP top level. PHP unlimited classification gets the top-level classification ID. PHP top-level has such a table, id is the ID of the classification, name is the classification name, and pid is the ID of the upper-level classification. Now there is a category ID, and the program needs to find it

A PHP class tree (supports unlimited classification)_PHP tutorial A PHP class tree (supports unlimited classification)_PHP tutorial

21 Jul 2016

A PHP class tree (supports unlimited classification). Recently, there have been a lot of questions asked about infinite classification trees, so I was happy to write one myself. I just finished it. You can try it and see how to implement it faster and simpler. Post your tree as well.

See all articles