用zend_acl ,把$acl最后生成的放到一个文件里,现在我把它反序列取出来,成为一个数组。但是我要取出单独一个角色和资源来判断非常麻烦,不知道大牛们是怎么做的,愿听指教。
- PHP code
Zend_Acl Object ( [_roleRegistry:protected] => Zend_Acl_Role_Registry Object ( [_roles:protected] => Array ( [guest] => Array ( [instance] => Zend_Acl_Role Object ( [_roleId:protected] => guest ) [parents] => Array ( ) [children] => Array ( [member] => Zend_Acl_Role Object ( [_roleId:protected] => member ) ) ) [member] => Array ( [instance] => Zend_Acl_Role Object ( [_roleId:protected] => member ) [parents] => Array ( [guest] => Zend_Acl_Role Object ( [_roleId:protected] => guest ) ) [children] => Array ( ) ) [admin] => Array ( [instance] => Zend_Acl_Role Object ( [_roleId:protected] => admin ) [parents] => Array ( ) [children] => Array ( ) ) ) ) [_resources:protected] => Array ( [entertain] => Array ( [instance] => Zend_Acl_Resource Object ( [_resourceId:protected] => entertain ) [parent] => [children] => Array ( ) ) [sports] => Array ( [instance] => Zend_Acl_Resource Object ( [_resourceId:protected] => sports ) [parent] => [children] => Array ( ) ) [news] => Array ( [instance] => Zend_Acl_Resource Object ( [_resourceId:protected] => news ) [parent] => [children] => Array ( ) ) ) [_isAllowedRole:protected] => [_isAllowedResource:protected] => [_isAllowedPrivilege:protected] => [_rules:protected] => Array ( [allResources] => Array ( [allRoles] => Array ( [allPrivileges] => Array ( [type] => TYPE_DENY [assert] => ) [byPrivilegeId] => Array ( ) ) [byRoleId] => Array ( ) ) [byResourceId] => Array ( [entertain] => Array ( [byRoleId] => Array ( [guest] => Array ( [byPrivilegeId] => Array ( [watch] => Array ( [type] => TYPE_ALLOW [assert] => ) ) [allPrivileges] => Array ( [type] => [assert] => ) ) [member] => Array ( [byPrivilegeId] => Array ( [watch] => Array ( [type] => TYPE_ALLOW [assert] => ) [edit] => Array ( [type] => TYPE_ALLOW [assert] => ) [add] => Array ( [type] => TYPE_ALLOW [assert] => ) ) [allPrivileges] => Array ( [type] => [assert] => ) ) [admin] => Array ( [byPrivilegeId] => Array ( [watch] => Array ( [type] => TYPE_ALLOW [assert] => ) [edit] => Array ( [type] => TYPE_ALLOW [assert] => ) [add] => Array ( [type] => TYPE_ALLOW [assert] => ) [delete] => Array ( [type] => TYPE_ALLOW [assert] => ) ) [allPrivileges] => Array ( [type] => [assert] => ) ) ) )……………… )