权限控制方法
程序员文章站
2022-05-22 13:24:17
...
跳至
$count = intval(2147483649) > 0 ? 64 : 32; $rules = range(1,$count); $allows = array_rand($rules, rand(2,$count)); $access = 0; foreach ($allows as $value) { $access |= 1 << array_search($value, $rules); } foreach ($rules as $key => $value) { echo ' [' . $value . ':' . ( ( $access & (1 << $key) ) ? 'Y' : 'N' ). '] '; }