zoukankan      html  css  js  c++  java
  • YII 接口 用户鉴权 问题

       开发项目过程中,有的时候必须需要传一个用户的token值(用户唯一标识ID), 才给返回json数据,不传的话,就提示用户鉴权失败。而有的时候不用传。对于这个问题,不需要传token值的方法体需要写在一个数组中。类似于这样:

    class PostController extends BaseApiController{

    protected $_method_not_check = [ //把函数体放在此处,该接口的参数就不用必须再传token值也可以返回json数据了
    'actionIndex',
    'actionWebCommunity',
    ...
    ];

    public function actionIndex(){
    dosomething..
    if(...)
    return $this->_result_success(...);
    else
    return $this->_result_error(...);
       }
    }
  • 相关阅读:
    注册系统
    android登录界面
    android作业 购物界面
    第六周jsp作业
    JSP第四周
    JSP第二次作业
    JSP第一次作业
    第一周软件测试
    第九次安卓
    购物菜单
  • 原文地址:https://www.cnblogs.com/wangshuazi/p/9630808.html
Copyright © 2011-2022 走看看