-
- //Recursively get the role ID string
- function explodeRole($roleObj, &$resultStr){
- if(0 < count($roleObj->childRoleObjArr)){
- foreach( $roleObj->childRoleObjArr as $childRoleObj){
- if('' == $resultStr){
- $resultStr .= "{$childRoleObj->id}";
- }else{
- $resultStr .= ", { $childRoleObj->id}";
- }
- explodeRole($childRoleObj, $resultStr);
- }
- }
- }
- //Recursively obtain the cascaded role information array
- function makeRoleRelation(&$roleObjArr){
- foreach($ roleObjArr as $item){
- $item->childRoleObjArr = getRoleObjArrByParentId($item->id);
- if(0 < count($item->childRoleObjArr)){
- makeRoleRelation($item->childRoleObjArr ; getAllColumn());
- $operCOGPSTRTSysRole->setWhere("parentroleid={$parentid}");
- $roleObjArr = $operCOGPSTRTSysRole->convResult2ObjArr($operCOGPSTRTSysRole->selectTable());
- return isset($roleObjArr )?$roleObjArr:array();
- }
-
-
- Copy code
-
-
- >>> Articles you may be interested in:
- PHP recursion and iteration to implement quick sort
php code to recursively obtain files in a directory (including subdirectories)
php infinite classification recursive function
Simple example code for PHP to recursively print all elements in an array
Two functions for php to recursively traverse directories
php custom function recursively replaces the contents of an array
Small example of php recursive call
A little understanding of recursive traversal of PHP arrays
php array recursive summation example
Code of infinite classification (recursive) implemented by php
php fully permuted recursive algorithm code
|