EasyWechat4.0 获取小程序手机号码

$iv = input("post.iv","","trim");
$session_key = input("post.session_key","","trim");
$encryptedData = input("post.encrypted_data","","trim");
if (empty($iv) || empty($session_key) || empty($encryptedData)){
   return output("请上传参数",400);
}

$config = [
   'app_id' => 'wx531d84deb69aee85',
   'secret' => '9cd17eda4663f03cc2a1a29aaaedaa80',

   // 下面为可选项
   // 指定 API 调用返回结果的类型:array(default)/collection/object/raw/自定义类名
   'response_type' => 'array',

   'log' => [
       'level' => 'debug',
       'file' => __DIR__.'/wechat.log',
   ],
];
try {
   $app = Factory::miniProgram($config);
   $result =$app->encryptor->decryptData($session_key, $iv, $encryptedData);;
   return output("登录信息",200,$result);
}catch (\Exception $e){
   return output($e->getMessage(),400);
}


白俊遥博客
请先登录后发表评论
  • 最新评论
  • 总共0条评论