AUth 验证 ?

浏览:4464 发布日期:2014/03/29 分类:求助交流 关键字: 求救
我已经建好了表和文件,但我为什么,我调用 $rule = strtolower('/'.MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME);
echo $rule;

static $Auth = null;
if (!$Auth) {
$Auth = new \Think\Auth();
}
if(!$Auth->check($rule,$_SESSION['uid'])){
echo '你没有权限';
}

就每一个模块都提示我没有权限呢? 我明明已经给他权限了啊  if(!IS_POST) {
                redirect(U('index')); 
             }
             $db = M('admin');
             $account = I('account');
             $password = I('password','','md5');
             $where = array('account'=>$account,'password'=>$password);
             $field = array('nickname','uid');
             $user = $db ->where($where)->field($field)->find();
             if(!$user) {
                $this->error('帐号或密码错误');
             } 
             
            
                
             }
             
              //写入session
             $_SESSION['uid'] = $user['uid'];
             $_SESSION['nickname'] = $user['nickname'];
             redirect(U('Index/index'));
common控制器 代码 if(!isset($_SESSION['uid'])) {
                redirect(U('Login/index'));
            }
            
              //  检测当前页是否有权限访问      // ' admin/index/index'
            $rule  = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME);
           
           //$rule = 'Home/Index/index';
           
            echo $rule;
            
            p(M('auth_rule')->select());
            
             $Auth       =   new \Think\Auth();
              if(!$Auth->check($rule,$_SESSION['uid'])){            
            echo '没有权限';
        }  
            
最佳答案
评论() 相关
后面还有条评论,点击查看>>