codecamp

sp_auth_check

sp_auth_check

上一页下一页

X1.5.0新增

sp_auth_check($uid,$name=null,$relation='or')

功能:

检查权限

参数:

$uid: 当前登录用户或者管理员的id

$name:需要验证的规则列表,支持逗号分隔的权限规则或索引数组,默认为当前url

$relation:如果为 'or' 表示满足任一条规则即通过验证;如果为 'and'则表示需满足所有规则才能通过验证

返回:

类型boolean

通过验证返回true;失败返回false 

使用:

sp_auth_check(2);
sp_auth_check(2,'admin/ad/index');
sp_auth_check(2,array('admin/ad/index'));
sp_auth_check(2,'admin/ad/index,admin/ad/add','and');

上一页下一页

sp_is_sae
sp_get_current_admin_id
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

后台管理

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }