【微信第三方平台】获取pre_auth_code

  作者: thtomatic  分类: php笔记   评论: [ 0 ] 条  浏览: [ 1590 ] 次

用到的函数(F,C)和 数据库结构以及“component_access_token”

在文章“【微信第三方平台】获取component_access_token”中查看


具体代码:


    protected function pre_auth_code()
    {
        $pre_auth_code = C('pre_auth_code',false);
        if(is_array($pre_auth_code) && !empty($pre_auth_code))
        {
            $time = $pre_auth_code['create_time'] +1600;
            if($time > time())
            {
                $this->pre_auth_code = $pre_auth_code['v'];
                return $pre_auth_code['v'];
            }
        }
        $this->component_access_token();
        $url = "https://api.weixin.qq.com/cgi-bin/component/api_create_preauthcode?component_access_token=".$this->component_access_token;
        $param['component_appid'] = $this->appId;
        $post_data = json_encode($param);
        $data = $this->postJson($url, $post_data );
        F('pre_auth_code',$data['pre_auth_code']);
        return $this->pre_auth_code();

    }


版权所有:《thtomatic》 => 《【微信第三方平台】获取pre_auth_code
本文地址:https://ask.mykeji.net/phpnotes/208.html
除非注明,文章均为 《简单记录》 原创,欢迎转载!转载请注明本文地址,谢谢。


发表评论:

    50.16ms