ningjiabing
    /**
     * 获取Token值
     * @param $corpid
     * @param $corpsecret
     * @return mixed
     * @author 宁佳兵 <meilijing.ning@foxmail.com>
     */
    function getToken($corpid,$corpsecret){
        $url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=".$corpid."&corpsecret=".$corpsecret."";
        $access_token = httpUrl($url);
        return $access_token;
        
    }
    
    /**
     * 远程调用url
     * @param $url
     * @param null $data
     * @return mixed
     * @author 宁佳兵 <meilijing.ning@foxmail.com>
     */
    function httpUrl($url,$data = null){
        $ch = curl_init ();
        curl_setopt ( $ch, CURLOPT_URL, $url );
        curl_setopt ( $ch, CURLOPT_POST, 1 );
        curl_setopt ( $ch, CURLOPT_HEADER, 0 );
        curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt ( $ch, CURLOPT_POSTFIELDS, $data );
        $result = curl_exec ( $ch );
        curl_close ( $ch );
        $arr=json_decode($result, true);
        return $arr;
    }

 

分类:

技术点:

相关文章:

  • 2021-04-03
  • 2021-12-04
  • 2022-12-23
  • 2021-12-04
  • 2021-12-04
  • 2021-12-04
  • 2021-11-07
  • 2021-12-04
猜你喜欢
  • 2021-12-04
  • 2021-12-24
  • 2021-12-04
  • 2021-12-04
  • 2021-09-10
  • 2021-12-04
  • 2021-12-04
相关资源
相似解决方案