search
Homephp教程php手册无限分类php 递归函数
无限分类php 递归函数Jun 13, 2016 am 10:08 AM
phpsqlandfunctionClassificationmethodunlimitedInquirepaymentofSimplerecursion

这款无限分类php 递归函数是一款php 与sql查询递归的方法,很简单就是查询一次当前分类没有没子类,如果有的话就再调用函数本身来操作,如果己经没有子类了就可以返回了。

这款无限分类php教程 递归函数是一款php 与sql查询递归的方法,很简单就是查询一次当前分类没有没子类,如果有的话就再调用函数本身来操作,如果己经没有子类了就可以返回了。

function createsortoptions ($selected=0,$parent_id=0,$n=-1)
{
global $db;
$sql = "select * from `@__article_sort` where `parent_id` = '{$parent_id}'";
$options = ";
static $i = 0;
if ($i == 0)
{
$options .= ' if ($row['sort_id'] == $selected)
{
$options .=' selected ';
}
$options .=">".str_repeat(' ',$n*3).$row['sort_name']."n";
$options .=createsortoptions ($selected,$row['sort_id'],$n);
}
}
return $options;
}

如果是用smarty模板的朋友可以如下调用

//– $tpl->assign('sort_list',createsortoptions ());
//– $tpl->assign('sort_list',createsortoptions ($sort_id));

 

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
php怎么把负数转为正整数php怎么把负数转为正整数Apr 19, 2022 pm 08:59 PM

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

解析JSP注释的使用方法和分类解析JSP注释的使用方法和分类Feb 01, 2024 am 08:01 AM

JSP注释的分类及用法解析JSP注释分为两种:单行注释:以结尾,只能注释单行代码。多行注释:以/*开头,以*/结尾,可以注释多行代码。单行注释示例多行注释示例/**这是一段多行注释*可以注释多行代码*/JSP注释的用法JSP注释可以用来注释JSP代码,使其更易于阅

php怎么设置implode没有分隔符php怎么设置implode没有分隔符Apr 18, 2022 pm 05:39 PM

在PHP中,可以利用implode()函数的第一个参数来设置没有分隔符,该函数的第一个参数用于规定数组元素之间放置的内容,默认是空字符串,也可将第一个参数设置为空,语法为“implode(数组)”或者“implode("",数组)”。

人工智能的分类有哪几种人工智能的分类有哪几种Feb 19, 2021 am 11:22 AM

人工智能的分类有认知AI、机器学习AI和深度学习。人工智能是研究、开发用于模拟、延伸和扩展人的智能的理论、方法、技术及应用系统的一门新的技术科学。

php怎么去除首位数字php怎么去除首位数字Apr 20, 2022 pm 03:23 PM

去除方法:1、使用substr_replace()函数将首位数字替换为空字符串即可,语法“substr_replace($num,"",0,1)”;2、用substr截取从第二位数字开始的全部字符即可,语法“substr($num,1)”。

如何在Python中使用神经网络进行分类?如何在Python中使用神经网络进行分类?Jun 04, 2023 pm 10:40 PM

当涉及到大量数据的分类时,人工处理这些数据是一件非常耗时且困难的工作。这种情况下,使用神经网络进行分类就可以轻松快捷地完成这项工作。Python是一种很好的选择,因为它有很多成熟且易于使用的神经网络库。本文将介绍如何在Python中使用神经网络进行分类。神经网络和分类在讲解如何使用神经网络进行分类之前,我们需要简要了解一下神经网络的概念。神经网络是一种

如何在Python中使用高斯混合模型进行分类?如何在Python中使用高斯混合模型进行分类?Jun 04, 2023 am 10:10 AM

本文将介绍在Python中使用高斯混合模型进行分类的基本概念与实现方法。什么是高斯混合模型?高斯混合模型(GaussianMixtureModel,GMM)是一种常见的聚类模型,它由多个高斯分布组成,在对数据进行分类时,使用这些高斯分布对数据进行建模,并通过自适应的方式确定每个样本所属的类别。GMM的基本原理GMM的基本原理是将数据集视为由多个高斯分布组

Linux系统日志文件分类详解Linux系统日志文件分类详解Feb 26, 2024 pm 02:33 PM

Linux系统日志文件是记录系统运行过程中产生的各种信息的重要文件,通过分析日志文件,可以帮助我们了解系统的运行状态、故障排查和性能优化。本文将深入探讨Linux系统日志文件的分类及其作用,同时结合具体的代码示例,帮助读者更好地理解。一、Linux系统日志文件分类1.系统日志系统日志是记录系统启动、关闭、用户登录、关机等重要事件的日志文件。在Linux系统

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools