在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
//生成php随机数
function randomkeys($length) { $pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ,./<>?;#:@~[]{}-_=+)(*&^%___FCKpd___0pound;"!'; //字符池 for($i=0;$i<$length;$i++) { $key .= $pattern{mt_rand(0,35)}; //生成php随机数 } return $key; } //------------------------------------ $num = 3; //取低16位,高位部分全部都为0 $num & 0x00FF; //3 //左移 <<, 低位补0 $num << 1; //6 //右移 >>, 高位补0 $num >> 1; //1 //------------------------------------ //位运算符 & 按位与运算 //都是1的才设为1, 7:bin(111), 2:bin(10), 7&2 输出bin(10),十进制为2 //权限操作 define('READ', 1); define('WRITE', 2); define('DELETE', 4); //User Permisssion 1:read 2:write 3:read+write 4:delete 5:read+delete 6:write+delete 7:all $userPermisssion = 4; //判断用户是否有权限, 为0则没有权限. if (!$userPermisssion & READ) { //access die } |
2022-07-18
2022-08-17
2022-11-06
2022-07-08
2022-08-17
请发表评论