简体   繁体   English

PHP的树类/数组结构到面包屑

[英]php tree class/array structure to breadcrumbs

Basically i received an API SOAP response of a list of categories in an class format as in array kind of way with CatID, name, parentID, level. 基本上,我以类格式使用CatID,名称,parentID,级别以数组形式收到了类别列表的API SOAP响应。

What is the best way to turn this into an array of breadcrumbs for each CatID. 将其转换为每个CatID的面包屑数组的最佳方法是什么。

I want to try reduce the number of operation as the array will be created on the fly to populate a drop down menu and there are over a 1000 categories 我想尝试减少操作数量,因为将动态创建数组以填充下拉菜单,并且有1000多个类别

I apologise in advance for my poor terminology and thank you for any help 对于我的用语不佳,我深表歉意,并感谢您的帮助

I solved it by converting it into an array and applying a tree algorithm to each element 我通过将其转换为数组并对每个元素应用树算法来解决它

I know its not very efficent 我知道它不是很有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM