简体   繁体   English

不同数组之间的PHP复杂检查

[英]PHP complex check between different arrays

My goal is to decide if the $iCurrentMembershipId can access the $aCurrentMenu array based on: if the $iCurrentMembershipId is in the $aRescrictAccess array. 我的目标是根据以下条件决定$iCurrentMembershipId可以访问$aCurrentMenu数组: $iCurrentMembershipId是否在$aRescrictAccess数组中。

if(is_array($aRescrictAccess)){
   // Not sure what to do
}

Ultimately, I would need deny access to the page if the users $iCurrentMembershipId is in the $aRescrictAccess array. 最终,如果用户$iCurrentMembershipId位于$aRescrictAccess数组中,则需要拒绝对该页面的访问。

if(is_array($aRestrictAccess)){
    if(in_array($iCurrentMembershipId, $aRestricAccess) === FALSE){
        /* display $aCurrentMenu */
    }
}

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

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