Home > Backend Development > PHP Tutorial > Unlimited distribution for PHP members

Unlimited distribution for PHP members

不言
Release: 2023-03-24 13:08:01
Original
9143 people have browsed it

The content introduced in this article is about the unlimited distribution of PHP members. It has a certain reference value. Now I share it with everyone. Friends in need can refer to it.

Premise: Member table structure There are user userid and recommender tjuid (recommender tjuid is the userid who recommended the member)

$where = "`userid` > 1";
    $ulist = $db->select($where,'userid,tjuid,username,nickname,mobile','','userid asc');

    //将$ulist数组键名重置为该数组元素的userid值
    foreach($ulist as $val){
        $items[$val['userid']] = $val;
    }

    //利用变量引用实现无限级分类
    foreach ($items as $item){
        $items[$item['tjuid']]['son'][$item['userid']] = &$items[$item['userid']];
    }

    print_r($items[0]['son']);
Copy after login


The above is the detailed content of Unlimited distribution for PHP members. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template