接口
https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
返回的JSON数据包,在php里用对象或数组获取值解密(或写入库)提示未定义!而通过return $session_key 小程序控制台里可见值。请问是怎么回事?
$openId = $this ->http_send( $wx_request_url , $param , 'get' ); $jsonkey =json_decode( $openId ); $array =get_object_vars( $jsonkey ); //$openId =json_decode($openId); $session_key = $array [ 'session_key' ]; $rawData = $_GET [ 'rawData' ]; //数字签名校验 $signature2 = sha1(htmlspecialchars_decode( $rawData ). $session_key ); $signature = input( 'get.signature' ); if ( $signature != $signature2 ) { echo "数字签名失败" ; die ; } |
怎么没伙伴回一下呢...