s_curl('https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx41e478e592f9e04a&secret=fc165de4aa5cd24b628baa30b100e146&code=' . $code . '&grant_type=authorization_code'); $R['flag'] = false; $R['data'] =$user_openid; $R['openid'] =$user_openid['openid']; $R['msg'] = '操作失败,Code获取失败'; header('Location:https://qhome.usky.cn/ceshi.html?R='.json_encode($R)); } } //token 日志 private final function tokenlog($token, $urls, $data = '') { try { M()->execute("INSERT INTO jdxf.token_log(token,url,`time`,data1) VALUES('$token','$urls',NOW(),'$data')"); } catch (Exception $e) { } } //远程调用连接 private function s_curl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $file_contents = curl_exec($ch); curl_close($ch); $arr = json_decode($file_contents, true); return $arr; } }