如何获取微信开放平台的预授权码?


怎样获取微信开放平台的预授权码?是通过填写的哪个url进入获取的?

报错:


 array(2) { ["errcode"]=> int(41002) ["errmsg"]=> string(13) "appid missing" }

代码部分:


 $ch = curl_init();
    $url="https://api.weixin.qq.com/cgi-bin/component/api_component_token";
    $data=array(
        'component_appid'=>$APPID,
        'component_appsecret'=>$SECRET,
        'component_verify_ticket'=>$ticket['ticket']
    );
    $data=http_build_query($data);
    //var_dump($data);

    $ch = curl_init();//打开
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
    $response  = curl_exec($ch);
    curl_close($ch);//关闭
    $result = json_decode($response,true);

微信开放平台 php 微信授权auth2

怪叔叔@——@ 11 years, 11 months ago

appid missing
你没有定义$APPID变量

迈克尔杰克逊 answered 11 years, 11 months ago

Your Answer