您的位置:首页 > 编程语言 > PHP开发

php学习3(权限判断)

2008-03-12 19:01 288 查看
#///////权限封装的是否有权限的处理////////////
function ModlePowerBool($BtypeValue,$BtypeSign){
$FinValue=0; //最终的返回数值
if(($BtypeValue&$BtypeSign)==$BtypeSign)
$FinValue=1;
return $FinValue;
}

function BitDouble($DecValue,$Type=2){
$FinValue=0; //最终的返回数组-1为定义起始点
$TmpFinValue=array(-1 => true); //最终的返回数组-1为定义起始点
$DecArrayValue=DecToBitArray($DecValue);
foreach($DecArrayValue as $DecValue)
{
for($IntFor=0;$IntFor<$Type;$IntFor++)
{
$TmpFinValue[]=$DecValue;
}
}
$FinValue=BitArrayToDec($TmpFinValue);
return $FinValue;
}
//返回为1,0.
function ChildModlePowerBool($BtypeValue,$ChildBtypeValue,$BtypeSign){
$FinValue=0;
$TmpValue=BitDouble($BtypeValue);
$TmpValue=$TmpValue&$ChildBtypeValue;
$FinValue=ModlePowerBool($TmpValue,$BtypeSign);
return $FinValue;
}
//返回为"true","false"字符.
function ChildModlePowerBoolEx($BtypeValue,$ChildBtypeValue,$BtypeSign){
$FinValue="false";
$TmpValue=BitDouble($BtypeValue);
$TmpValue=$TmpValue&$ChildBtypeValue;
if(ModlePowerBool($TmpValue,$BtypeSign))
$FinValue="true";
return $FinValue;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: