thinkphp3.2.3 中 Auth 使用check的问题

浏览:2792 发布日期:2016/03/05 分类:求助交流 关键字: thinkphp auth auth权限验证 check check方法参数
源代码中check()方法: @param name string|array  需要验证的规则列表,支持逗号分隔的权限规则或索引数组但是当我传递数组时并没有 用,只有传递像'rule1,rule2,...,rulen'这样的字符串才可以,
自己试验时,源代码中的是字符串的判断:
假如$name= 'Admin/Index/index,Admin/Delete/index,Admin/Read/index';if (is_string($name)) {
            $name = strtolower($name);
            if (strpos($name, ',') !== false) {
                $name = explode(',', $name);
            } else {
                $name = array($name);
            }
        }
输出:array (size=1)
  0 => string 'admin/index/indexadmin/curd/indexadmin/delete/indexadmin/read/index' 
我的问题是Auth类的check()输入数组不管用吗?
我的解决方法是:
$check_arr = array(
'Admin/Index/index',
'Admin/CURD/index',
'Admin/Delete/index',
'Admin/Read/index',
);
$name= implode(',',$check_arr);

附件 代码.zip ( 4.17 KB 下载:9 次 )

最佳答案
评论( 相关
后面还有条评论,点击查看>>